Quick Question: RVO and looking

Where should I insert code to get the RVO controller’s direction ?? I would like to write some code so my units always look in the direction there moving :slight_smile:

I assume somewhere around here:
`…
rvoAgent.DesiredVelocity = desiredVelocity + force*wallAvoidForce;

tr.position = rvoAgent.InterpolatedPosition + Vector3.up*height*0.5f + center;

    // Insert something like: Look at last position + 180º??
	
lastPosition = tr.position;

…
`
Thanks!
Burdock~

The RVOController has the field velocity. That should work, right?
I.e transform.LookAt (transform.position + controller.velocity);

Note however that velocity is quite unstable at low velocities. So you might want to add some minimum magnitude of the velocity to rotate towards it.

FYI my final code was this:

` public static void TurnAB(int UnitTurnSpeed, Transform Player ){
Vector3 velocity = Player.GetComponent().velocity;

	if(velocity.magnitude < .01 ){//Low Pass Check: Is this low enough? Can I drop It a lot lower??
	    return;	
	}
	Quaternion LookRotation = Quaternion.LookRotation(velocity);
	Quaternion rotation = Quaternion.Slerp(Player.rotation, LookRotation , Time.deltaTime * UnitTurnSpeed);
	Player.rotation = Quaternion.Euler(0, rotation.eulerAngles.y, 0);
    }`

(For any other people out there trying to do the same thing) FYI:
Quaternion LookRotation is a little faster then LookAt due to not needing a comparison to transform.position~