First of all, TrackballControls
and OrbitControls
rotate the camera, not the objects.
Second, OrbitControls
enforces the camera up
direction, and TrackballControls
allows the camera to rotate upside-down.
TrackballControls
has a reset()
method, which restores the target
(center of rotation), camera position
, and camera up
vector to their original settings.
controls.reset();
The above code will restore the original position
, target
, and up
vector. You can change those too, if you want, before you call controls.reset()
.
controls.position0.set( 0, 0, 10 ); // set a new desired position
controls.target0.set( 0, 0, 0 ); // set a new target
controls.up0.set( 0, 1, 0 ); // set a new up vector
controls.reset();
Read the reset()
function source code so you understand what it is doing.
EDIT: OrbitControls
now has a reset()
method, too. Check the source code.
three.js r.82
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…