Controlling Nav Mesh Agent speed, always returns 1

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;
 
Just wanted to post about the same issue. I am using Behaviour Designer with the Movement Package but I am unable to control the AI characters' speed. I also realized that the NavMesh Agent speed parameter doesn't have any influence on the characters' actual speed. I found this to be strange since both systems are meant to work together, right?
 
You should use the speed change ability or modify the motor acceleration values in order to change the speed. This page has more info:

 
Top