#How do I zoom into each planet?

12 messages · Page 1 of 1 (latest)

sage dawn
#

You are using orbitcontrol, right?
Then you can use orbitControls.target(x, y, z).

#

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.

sullen sleet
#

just use camera-controls, google it, it's a controlable orbit control

#

it can zoom-to-fit objects easily

sage dawn
#

I think this thing makes this channel dirty.

sullen sleet
#

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

GitHub

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features. - GitHub - yomotsu/camera-controls: A camera control for three.js, similar to THREE....