Dear all
After Loading an object, I hope I can move its center to coordinate system center;
However, I have use translateX… and it does not work at all.
Is there any other command I can use to move object ? thank you
Dear all
After Loading an object, I hope I can move its center to coordinate system center;
However, I have use translateX… and it does not work at all.
Is there any other command I can use to move object ? thank you
root.translateX = - 100; root.translateZ = - 100;
translateX
and translateZ
are functions so you have to call them instead of setting their value. See the Object3D docs for more info:
https://threejs.org/docs/index.html#api/en/core/Object3D.translateX
Basically, when you add scene.add(root)
=> root
object will be added in the center of the scene, means (0,0,0)
.
If you wanna move the object to the center (or anywhere else), just do:
root.position.set(0, 0, 0)
Personally, I don’t rarely use camera.lookAt()
, it might change the camera projectionMatrix
(I guess ) => you probably need to update the projection matrix of camera as well.
Best,