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:
I guess finding bug fixes is better than finding bugs
Thanks for the tip with using sideOrientation!
Edit:
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
Hello!
Yep this is actually a bug fix 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: https://playground.babylonjs.com/index.html#3DVI2L#2
I guess finding bug fixes is better than finding bugs
Thanks for the tip with using sideOrientation
!
Edit:
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
2 Likes