Hello everyone,
To fix an issue in my project, I need for the lookAt(mesh.position) code to only apply to the Z and Y axes, and not the X axis. Is this possible? A modified PG from the documentation examples is below. The goal is to eliminate the boxes from looking “up” or “down” when the sphere moves above or below them on the Y axis.
https://playground.babylonjs.com/#N2K3ZN#14
Thanks in advance for any help or suggestions!
Does this work for you ?
https://playground.babylonjs.com/#N2K3ZN#15
I am caching the rotation before lookAt function and replacing it back after running lookAt.
2 Likes
Hello @Michael_Prosser, and thanks for helping out with this! The code you added works perfectly in the PG, however, I’m still having issues when I apply the code in my project. I’ll try to create another example PG tomorrow that replicates exactly what’s happening. Thanks again!
1 Like
Hello again,
The issue was not with the code, but rather with the Blender model I imported. The Blender model coordinates/attributes were not matching with babylon.js.
In case this helps anyone else in the future, here’s what fixed the strange issues:
I set the mesh and armature transforms to:
Location: 0, 0, 0
Rotation: 0, 0, 0
Scale: 1,1,1
Then selected everything and applied all transforms.