I am using orbit control for zoom and pan action. while zoom out, after a certain limit, the object has disappeared. Similarly, while Zoom in, I can’t zoom after a certain limit. But I have set the max limit to
1000 . Even though I increase the limit, I can zoom in about that same limit only. What is the reason behind this.
controls= new OrbitControls(camera,renderer.domElement); controls.minDistance=-700;
this is the settings for orbit controls. and the following is the setting for camera control.
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 1000 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.position.set( 0, 0,450);
camera.lookAt( 0, 0, 450 );
Now I have changed the
.far parameter of perspectiveCamera into 2000. Now the zoom out issue has cleared. How to fix the zoom in issue?
The third parameter is the min or near distace, you can set it to 0.01 for example. Keep in mind that if you set the near and far distances too far away, you will have rendering artifacts due to the depth buffer precision limits.
Thanks for your reply @yombo. Rendering artifacts means what?
Two overlapping objects (for example the ground and a tree) will have odd mixing of pixels instead of clean intersection edges where they overlap.
Yes @yombo. you are right, that is occurring. But no improvement in zoomin limit
Oh, that must be a limit of OrbitControls. Just look at its code (or the docs) to see which parameter limits the zoom in.
Okay @yombo. Thanks for your kind information. if you know that. please tell me
Yes @yombo. you are obviously right. When I set the Maxdistance property, then the zoom out has limited. But, Similary I have set the mindistance property. But it is not working. I think Something is restricted that
Oh, sorry now I see. I think minDistance cannot be negative… Please try setting it to 0.
No improvement @yombo. Still I can zoom at that level only. any other camera factor affect this?
At this point you’ll need to share a fiddle. Do you know how?
Also check minZoom… But it is 0 by default, as minDistance
minZoom is only for orthographic camera. But I am using perspective camera
Now I see you are using
camera.lookAt. You should use instead
In the video, the camera is reaching the target position, which is 0, 0, 0. Try setting the target to 0, 0, -300 for example.
Oh. So i should remove the
Yes, though it doesn’t affect since the controls are overriding it.