PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Moving Objects by Applying Force

Moving Objects by Applying Force

Jun 14 2019, 4:47 PM PST

Problem

You want to move a part in a certain direction with a certain force.

Solution

Use the BodyThrust object controlled with the force property.

local b = Instance.new('BodyThrust')
b.force = Vector3.new(0, 5000, 5000)
b.location = Vector3.new(0, 100, 100)
b.Parent = Workspace.Part

Discussion

The BodyThrust object uses its force property to control the force on each respective axis. Then it uses its location property to determine the direction in which is going to apply the force.

The BodyForce object is older and is ultimately intended to be replaced by VectorForce. We recommend you use VectorForce instead.
Tags:
  • physics
  • bodyforce
  • movement
  • coding