Behavior of mesh.lookAt() changed between v3.3 and v4.0.0-alpha.15


I noticed that the mesh.lookAt() behavior changed when switching from v3.3 to the latest alpha (v4.0.0-alpha.15).

I couldn’t find anything in the “What’s new” doc that could explain the issue.

Here is a playground with v3.3:

And here with v4.0.0-alpha.15:
(just fly past the ground and turn around and you’ll see the plane again)

Alternative solution:



Yep this is actually a bug fix :slight_smile: The plane is meant to have its normal facing toward negative Z. So calling lookAt will make it rotate this other way around (Which is the correct behavior now in 4.0)

If you apply the lookAt to the ground, you’ll see that both versions are consistent.

In the case of the plane, you can simply rcreate it with normal facing toward positive z:


I guess finding bug fixes is better than finding bugs :slight_smile:

Thanks for the tip with using sideOrientation!

And in case you have a plane with a texture that you don’t want to be flipped, you can also do this instead to get a “lookAway”:

plane.lookAt(plane.position.multiply(new Vector3(2, 2, 2)).subtract(this._scene.activeCamera.position));

Credits: LookAt in opposite direction? - Unity Answers