Skip to content

Commit

Permalink
Fix distance calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Jan 14, 2024
1 parent 0b42fd1 commit 9156b91
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions sandbox/three_shadow3.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
{
let size = new THREE.Vector2 (10.0, 5.0);

this.shadowCamera = new THREE.OrthographicCamera (-size.x / 2.0, size.x / 2.0, size.y / 2.0, -size.y / 2.0, 0.0, 10.0);
this.shadowCamera.position.z = -5;
this.shadowCamera.scale.z *= -1;
this.shadowCamera = new THREE.OrthographicCamera (-size.x / 2.0, size.x / 2.0, size.y / 2.0, -size.y / 2.0, 0.0, 8.0);
//this.shadowCamera.scale.z *= -1;
//this.shadowCamera.position.z = 6;
this.shadowCamera.rotation.y = Math.PI;
//this.shadowCamera.rotation.z = Math.PI;
shadowGroup.add (this.shadowCamera);

this.shadowRenderTarget = new THREE.WebGLRenderTarget (1024, 1024);
Expand Down Expand Up @@ -56,6 +58,7 @@
};

this.shadowPlaneMesh = new THREE.Mesh (planeGeometry, planeMaterial);
this.shadowPlaneMesh.scale.x *= -1.0;
shadowGroup.add (this.shadowPlaneMesh);
}

Expand Down Expand Up @@ -132,10 +135,12 @@
});
let boxMesh1 = new THREE.Mesh (box1, boxMaterial);
let boxMesh2 = new THREE.Mesh (box2, boxMaterial);
boxMesh1.position.z = 4;

boxMesh1.position.z = 3;

boxMesh2.position.x = 1;
boxMesh2.position.y = 1;
boxMesh2.position.z = 2;
boxMesh2.position.z = 1;

boxMesh1.updateMatrixWorld (true);
boxMesh2.updateMatrixWorld (true);
Expand Down

0 comments on commit 9156b91

Please sign in to comment.