Skip to content

Commit 9156b91

Browse files
committed
Fix distance calculation.
1 parent 0b42fd1 commit 9156b91

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

sandbox/three_shadow3.html

+10-5
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
{
2525
let size = new THREE.Vector2 (10.0, 5.0);
2626

27-
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);
28-
this.shadowCamera.position.z = -5;
29-
this.shadowCamera.scale.z *= -1;
27+
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);
28+
//this.shadowCamera.scale.z *= -1;
29+
//this.shadowCamera.position.z = 6;
30+
this.shadowCamera.rotation.y = Math.PI;
31+
//this.shadowCamera.rotation.z = Math.PI;
3032
shadowGroup.add (this.shadowCamera);
3133

3234
this.shadowRenderTarget = new THREE.WebGLRenderTarget (1024, 1024);
@@ -56,6 +58,7 @@
5658
};
5759

5860
this.shadowPlaneMesh = new THREE.Mesh (planeGeometry, planeMaterial);
61+
this.shadowPlaneMesh.scale.x *= -1.0;
5962
shadowGroup.add (this.shadowPlaneMesh);
6063
}
6164

@@ -132,10 +135,12 @@
132135
});
133136
let boxMesh1 = new THREE.Mesh (box1, boxMaterial);
134137
let boxMesh2 = new THREE.Mesh (box2, boxMaterial);
135-
boxMesh1.position.z = 4;
138+
139+
boxMesh1.position.z = 3;
140+
136141
boxMesh2.position.x = 1;
137142
boxMesh2.position.y = 1;
138-
boxMesh2.position.z = 2;
143+
boxMesh2.position.z = 1;
139144

140145
boxMesh1.updateMatrixWorld (true);
141146
boxMesh2.updateMatrixWorld (true);

0 commit comments

Comments
 (0)