Rotating an Object3D to match the same orientation as another Object3D

Hello,

I assume the answer here would have something to do with the quaternion of the Object3Ds.

I am able to rotate an Object3D to face the same point as another Object3D if they both have the same center / position. I use the Object3D[‘quaternion’] property of the one with desired rotation and use the Object3D.applyQuaternion() method on the target Object3D. The problem occurs when the target Object3D is at a different position.

Is there a method that can do the proper rotation or do I need to do some translation back, rotate and translate the Object3D back? Thanks.

Hello! If i understood, for rotation u need to use mesh.lookAt(0,4,5);

1 Like

I shall give that a try and report back. Thank you.

If I may jump in:

Being at different positions and having the same orientation is not the same thing as looking at the same target. In the former case the orientation vectors are parallel, while in the latter case they converge at the target.

The lookAt() method would match the former case only if the target was “infinitely” far away.

1 Like

@Superman

on a completely unrelated note:

with a nick like yours, you should complement it with an adequate avatar, too: :wink:

1 Like