Navmesh Target Rotation

atmuc

Member
I set SetDestinationRotation. It does not change the result. I also tried rotation override options. How can I set final rotation of navmesh movement?

var setDestination = _navMeshAgentMovement.SetDestination(targetOnNavmesh);
_navMeshAgentMovement.SetDestinationRotation(Target.value.rotation);
 
The navmesh has to reach its destination first and then assuming the DestinationRotation variable is not null it'll use that rotation. The rotation overrides only apply while the agent is moving. You can see what it is doing by inspecting the lookRotation variable on the NavMeshAgentMovement.
 
As I understand Navmesh can just create straight paths from start to end. I need a path finish with target orientation.

1681321521309.png
 
I don't think the NavMeshAgent is capable of producing a curve like that. For that you'll likely need to implement your own steering behavior based on sampling the navmesh position. This can be done with a new ability that is independent of the NavMeshAgent. The DestinationRotation will not give you those results.
 
Top