Collider:setLinearVelocity

Edit

Sets the world-space linear velocity of the center of mass of the Collider.



Set the linear velocity of the collider using numbers.

Arguments

NameTypeDescription
vxnumber The x component of the new velocity, in meters per second.
vynumber The y component of the new velocity, in meters per second.
vznumber The z component of the new velocity, in meters per second.

Returns

Nothing

Set the linear velocity of the collider using a vector.

Arguments

NameTypeDescription
velocityVec3 The new velocity, in meters per second.

Returns

Nothing

Notes

Although setting the velocity directly is useful sometimes, it can cause problems:

Using forces and impulses to move Colliders will avoid all of these issues.

If the Collider is asleep, setting the velocity to a non-zero value will wake it up.

If the Collider has a tag that was marked as static when the World was created, then the Collider can not move and this function will do nothing.

Currently, velocity is clamped to 500 meters per second to improve stability of the simulation.

See also