Bispen
April 3, 2018, 7:57pm
1
Typing :
camera = new THREE.PerspectiveCamera(30, container.offsetWidth / container.offsetHeight, 0.1, 5);
camera.position.set(0.5, 0.2, 0.5);
var helper = new THREE.CameraHelper( camera);
scene.add( helper );
… whatever the position the camera I set, CameraHelper doesn’t move. Is there any trick missing here?
Thank you guys.
Please have a look at: https://threejs.org/examples/#webgl_camera
Do you update your helper in the animation loop?
1 Like
Bispen
April 4, 2018, 10:04am
3
Michael, in this example they attach the camera and the helper to e Group.
Seems to work now - don’t know what happened. I’ll reopen this post in case of!
The premise of using ‘CameraHelper’ is to use at least two cameras, so that ‘CameraHelper’ will appear completely on the screen.
‘CameraHelper’使用有意义的前提是至少使用两个相机,这样‘CameraHelper’才会完整的出现在屏幕内.
So strange API:
// addition
cameraRig = new THREE.Group();
cameraRig.add( camera2 );
scene.add( cameraRig );
What if we add this in source code? Seems that adding two Groups not changing anything and saving backward compatibility.
YSLdev
June 14, 2024, 1:11pm
6
Had the same problem recently. Looks like you should add the camera
itself to the scene too.
scene.add(camera, cameraHelper);