Crowd.Agent face forward along path?

Am I missing a parameter or something that will orientate the mesh (agent) to face forwarded as it moves along the navmesh path?

Also is there a way to find out where the agent is along the path (points)?

Pinging @Cedric

For the orientation, you can use this function to get the agent velocity

For the path, you can compute it using this function and get an array of points:

1 Like
var velocity = crowd.getAgentVelocity(0);
var angle = Math.atan2(velocity.x, velocity.z) ;
var quaternion = new BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, angle);
mesh.rotationQuaternion = quaternion;

Thanks So much

1 Like