float Height { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Height property of the NavMeshAgent class represents the height of the agent in the navigation mesh. This property is crucial for ensuring that the agent can navigate through areas with height restrictions, such as doorways or tunnels, without collision issues.

Usage

To set the height of a NavMeshAgent, simply assign a float value to the Height property. This value should be set according to the physical dimensions of the agent in the game world.

Example

// Create a new NavMeshAgent instance
NavMeshAgent agent = new NavMeshAgent();

// Set the height of the agent
agent.Height = 2.0f;

// Use the agent in the scene
agent.MoveTo(new Vector3(10, 0, 10));