SpawnStorm
New member
I'm attempting to manage the speed of my AI character. It has an UCC Locomotion script with the Nav Mesh Agent Movement ability attached. My goal is that I can adjust the Nav Mesh Agent > Speed parameter (Unity's native script) as the game plays. I'm testing this behavior with the sample script in the Set Destination sample of https://opsive.com/support/document...ies/included-abilities/navmeshagent-movement/
I am not using Root Motion Position in the UCC Locomotion Motor. Although ultimately I will do that.
However, adjusting this value has no effect on the AI's movement. I think I know why, but want confirmation or alternatives prior to modifying the UCC source.
In NavMeshAgentMovement > Update - Lines 152 - 163; the NavMeshAgent desiredVelocity and velocity fields are properly read from the Nav Mesh Agent. However, at line 163, they are normalized against the look direction. This results in a forward velocity of 1 on the InputVector (assuming your AI is already facing the target). Perhaps a clamp to 1 instead of always normalizing is one approach to this.
Rough test:
velocity = Quaternion.Inverse(lookRotation) * direction;
I am not using Root Motion Position in the UCC Locomotion Motor. Although ultimately I will do that.
However, adjusting this value has no effect on the AI's movement. I think I know why, but want confirmation or alternatives prior to modifying the UCC source.
In NavMeshAgentMovement > Update - Lines 152 - 163; the NavMeshAgent desiredVelocity and velocity fields are properly read from the Nav Mesh Agent. However, at line 163, they are normalized against the look direction. This results in a forward velocity of 1 on the InputVector (assuming your AI is already facing the target). Perhaps a clamp to 1 instead of always normalizing is one approach to this.
Rough test:
velocity = Quaternion.Inverse(lookRotation) * direction;