PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. Instead, you should go to our new and improved documentation. You can also learn more about the future of documentation.
Collapse Sidebar

Velocity

BasePart

Vector3

The Velocity of a part describes how its /BasePart/Position is presently changing. The unit of this property is studs per second. For reference, the default Roblox character moves at 16 studs per second via /Humanoid/WalkSpeed. The acceleration due to gravity is found in /Workspace/Gravity (by default, -196.2 studs per second).

Setting the Velocity of an part that is /BasePart/Anchored will cause it to act like a conveyor belt. Any object that touches the part will begin to move in accordance with the Velocity.

Some /BodyMover objects will apply forces and thus change the Velocity of a part over time. The simplest of these is a /BodyForce which can be used to counteract the acceleration due to gravity on a single part (set the +Y axis of the /BodyForce/Force to the product of the mass (/BasePart/GetMass) and the gravity constant).


Code Samples


Projectile Firing

This code sample fires a part from one position toward another. It calculates the velocity needed to reach the destination in time, and applies an anti-gravity effect using a BodyForce. In addition, it adds a Trail to better visualize the path of the projectile as it arcs through the air.