im a little confused at how babylon functions are executed coming from a unity background.
could someone please explain how mesh.lookAt is executed, specifically in the following playground:
https://www.babylonjs-playground.com/#UMQ4UR#2
as you can see line 44 has: box.lookAt(sphere.position);
to my understanding this instantly will cause the box to look at the sphere. Executing this outside of the registerBeforeRender update thread shows this. My confusion is does the box snap to lookat the sphere then snap back to the original which has been slerped a certain percentage all within one frame? does the mesh actually move at all within this frame or because the frame hasnt completed the mesh has not moved to the lookat position then back to the slerped pos?
would appreciate clarification.
Hello @tommox86
Yes, the box rotation is changed before the frame is rendered.
I added some comments to the playground that perhaps can help !
PG: https://www.babylonjs-playground.com/#UMQ4UR#4
Hope it helps !
1 Like
yes i was thinking this was the case, much appreciated for the clarification.
1 Like