The Velocity
property of the PhysicsBody
class represents the linear velocity of the physics body in world space. This property is used to get or set the speed and direction at which the physics body is moving.
The Velocity
property of the PhysicsBody
class represents the linear velocity of the physics body in world space. This property is used to get or set the speed and direction at which the physics body is moving.
To access or modify the velocity of a PhysicsBody
instance, use the Velocity
property. This property is of type Vector3
, which means it contains three components: X, Y, and Z, representing the velocity in each respective axis.
// Example of setting the velocity of a PhysicsBody PhysicsBody body = new PhysicsBody(); body.Velocity = new Vector3(10.0f, 0.0f, 0.0f); // Sets the velocity to 10 units per second along the X-axis // Example of getting the velocity of a PhysicsBody Vector3 currentVelocity = body.Velocity; // currentVelocity now holds the current velocity of the body