The BodyForce object applies (or exerts) a force on the part to which it is parented. If the magnitude of such a force is great enough, parts can begin to accelerate. See Newton’s First Law of Motion. The force is determined by the
BodyForce/Force property, and is defined on the three world axes.
A BodyForce alone cannot apply a torque (it cannot cause the parent to rotate on its own). To apply a force at a specific point (e.g. to apply torque for angular acceleration) or apply forces relative to the orientation of the part, use a
Forces Relative to Parent
CFrame:vectorToWorldSpace(Vector3) method, it is possible to translate a force vector that is relative to the part into the world vector necessary for
BodyForce/Force|Force. For example, to apply a force to the left an object (no matter which way it’s facing), try:
magnitude = 100 left = Vector3.new(-1, 0, 0) * magnitude -- You could also use Vector3.FromNormalId(Enum.NormalId.Left) bodyForce.Force = bodyForce.Parent.CFrame:vectorToWorldSpace(left)
You can also use a
BodyThrust with a
(0, 0, 0), then set the
BodyThrust/Force|Force for the same effect.
BodyForce is commonly used to counteract the effects of
Workspace/Gravity|Gravity on a per-part basis by simply applying a force in the +Y direction. See the code samples for more information.