Hello! I’m looking through the code for the OrbitControls script, but I can’t find a way to set the distance of the camera from its target manually, only the min and max distance that the user can view the target from. I’d like this feature in order to reset the zoom when switching between viewable objects for an app I’m making.
Hello, you can set the camera target position / camera position by calling ‘setCameraTarget’ with a position in localspace and true to set the position immediately.
(The method name is not ideal, it refers to the target position where the camera should move to and not of that of the look target, that is ‘setTarget’)
If you want a specific distance you have to calculate that in your code by e.g. storing the start position/direction and length depending on what exactly you need