Course contentsShow
← Unity Game Development
Lesson 514 of 8288. Artificial IntelligenceFree lesson

Refining Agent Movement and Steering Behavior

You will adjust agent acceleration, angular speed, and stopping distance parameters to achieve realistic movement patterns for different character types.

In this lesson, you will learn how to fine-tune NavMeshAgent parameters to give your AI characters unique, believable movement traits.

By default, a NavMeshAgent moves with generic settings that often look robotic. To create realistic movement, you must adjust the agent's steering parameters to match the character’s physical nature—such as the difference between a heavy armored knight and a nimble scout.

Balancing Acceleration and Angular Speed

The acceleration value dictates how quickly an agent reaches its top speed. A high acceleration makes an agent feel "snappy" or reactive, while a low value creates a sense of weight and inertia, perfect for larger creatures.

The angularSpeed controls how fast the agent rotates to face its destination. If this value is too high, the agent snaps instantly to new headings, which breaks immersion. By lowering this for "heavy" characters, you force the agent to perform wider, more realistic turns as it navigates corners.

Managing Stopping Distance

The stoppingDistance parameter is crucial for avoiding jittery behavior. If you set this too low, the agent may vibrate at the destination point while attempting to reach a precise coordinate. By increasing this value, you allow the agent to come to a smooth, natural halt before reaching the target center.

You can modify these values directly through code based on your character's current state:

public class AgentMovementRefiner : MonoBehaviour 
{
    private NavMeshAgent agent;

    void Start() 
    {
        agent = GetComponent<NavMeshAgent>();
        
        // Example: Making a heavy character feel sluggish
        agent.acceleration = 2f;
        agent.angularSpeed = 60f;
        agent.stoppingDistance = 1.5f;
    }
}

By tweaking these values, you transition from "placeholder movement" to character-specific behavior that feels grounded in the world. When an agent enters a new state (like transitioning from a "Patrol" to a "Chase" state), consider using a ScriptableObject to store sets of these movement configurations, allowing you to swap between "Heavy" and "Light" movement profiles dynamically without hardcoding values in your logic scripts.

Key Takeaway: Realistic AI movement is achieved by fine-tuning acceleration, angular speed, and stopping distance to reflect the physical mass and responsiveness of your specific character archetypes.