#How do I zoom into each planet?
12 messages · Page 1 of 1 (latest)
You may can ask to chatGPT
const orbitControls = new OrbitControls(camera, renderer.domElement); orbitControls.target.set(0, 5, 0);
WYM?
Could you explain your requirements more detaily?
Then what is the problem using target?
You can set target position as Earth's current position and set camera position with Earth's current position.
For example,
orbitControls.target.set.copy(Earth.position.clone()); camera.position.set(Earth.position.x + .., Earth.position.y + .., Earth.position.z + ..);
I think it must be in animate function to set these values real-time.
?????????
You can deal with that with initial knowledge of js.
just use camera-controls, google it, it's a controlable orbit control
it can zoom-to-fit objects easily
here are two examples, this uses setLookAt https://codesandbox.io/s/enter-portals-9m4tpc
and this one uses fitToBox https://codesandbox.io/s/portal-shapes-8j36ok
I think this thing makes this channel dirty.
it's not so complicated either, cc works just like oc, the docs describe how to use it https://github.com/yomotsu/camera-controls
the only difference is that you have extra methods like controls.fitToBox(someMesh, true) and that already would do it