Description
The Acceleration
property of the NavMeshAgent
class specifies the maximum acceleration that the agent can achieve. This property determines how quickly the agent can change its velocity. For snappy movement, it is recommended that the acceleration value be set as high or higher than the MaxSpeed
property of the NavMeshAgent
.
Usage
To adjust the acceleration of a NavMeshAgent
, simply set the Acceleration
property to the desired value. This will affect how quickly the agent can change its speed when navigating the navmesh.
Example
// Create a new NavMeshAgent
NavMeshAgent agent = new NavMeshAgent();
// Set the acceleration to a desired value
agent.Acceleration = 10.0f;
// Optionally, set the maximum speed
agent.MaxSpeed = 8.0f;
// Now the agent will accelerate up to its maximum speed at the rate specified by the Acceleration property.