Description
The WishVelocity
property of the PlayerController
class represents the desired velocity of the player. This is the velocity that the player wishes to move towards, which can be influenced by player input or other game mechanics. It is a Vector3
type, allowing for three-dimensional movement control.
Usage
Use the WishVelocity
property to set or get the desired movement direction and speed for the player. This property is synchronized across the network, ensuring consistent player movement in multiplayer scenarios.
Example
// Example of setting the WishVelocity in a PlayerController
PlayerController playerController = new PlayerController();
// Set the desired velocity to move forward at a speed of 5 units per second
playerController.WishVelocity = new Vector3(0, 0, 5);
// Access the current wish velocity
Vector3 currentWishVelocity = playerController.WishVelocity;
// Output the current wish velocity
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use in-game debugging tools or UI elements to display this information
// Debug.Log(currentWishVelocity);