Hey guys,
How can i calculate sprite.angle if i have 2 vector3 (currentPosition) and (nextPosition) ?
You can do a bit of trigonometry (assuming you want to angle between your direction and say (0, 0, 1):
let myAngle = Math.acos(BABYLON.Vector3.Dot(new BABYLON.Vector3(0, 0, 1), BABYLON.Vector3.Normalize(nextPosition.subtract(currentPosition)))
So if i want angle on xy i put Vector3(0, 0, 1) to Vector3(1,1, 0)?
correct
Thanks