How to locate the position of the model?

Hello everyone. I have a question to ask everyone:

I added a GLB model, which includes a building. Set camera parameters: camera.position.set(0, 0, 15); The effect of its presentation is as follows:

I think this position and angle are not ideal.
I used the right mouse button to drag it and changed its position. I also used the left mouse button to rotate it by an angle.
It looks very perfect now.

So, during this process, what parameters did three.js change?
I want to show this building in a good position and angle once the GLB is loaded.
Looking forward to your help, thank you!

camera.position and camera.quaternion (or together as camera.matrix) - position of the model is not modified. If you’re using controls, also controls.target is modified.

2 Likes

And if using OrbitControls you only need to save:

console.log(camera.position)
console.log(controls.target)

Since when you restore those 2 values, OrbitControls will re-orient the camera automagically or next time you call controls.update()

1 Like