Vector3 WishVelocity { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The WishVelocity property of the NavMeshAgent class represents the desired velocity of the agent. This is the velocity that the agent aims to achieve based on its current path and target position. It is a Vector3 value, indicating the direction and speed the agent wishes to move towards.

Usage

Use the WishVelocity property to get or set the desired velocity of the NavMeshAgent. This can be useful for debugging or for implementing custom movement logic where you need to know what the agent is trying to achieve in terms of movement.

Example

// Example of accessing the WishVelocity property
NavMeshAgent agent = new NavMeshAgent();

// Set the desired velocity
agent.WishVelocity = new Vector3(1.0f, 0.0f, 0.0f);

// Get the current desired velocity
Vector3 currentWishVelocity = agent.WishVelocity;

// Output the current wish velocity
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use a logging system or debug tools provided by the engine
Debug.Log($"Current Wish Velocity: {currentWishVelocity}");