Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make sure a part stays in place and moves with BodyForce?

Asked by
xEiffel 280 Moderation Voter
5 years ago
Edited 5 years ago

Does anyone know how to make sure an object stays on the same Vector3 coordinates and not fall to the ground when unanchored and using a BodyForce?

If I cant then does anyone know another BodyMover that can do the same effect im trying to do with moving a part in a certain direction?

Example of what I have currently: https://gyazo.com/a0acb6cf3d0e9cb8cd69dd08a4da3644

1 answer

Log in to vote
2
Answered by
BenSBk 781 Moderation Voter
5 years ago
Edited 5 years ago

To simulate anti-gravity on a BasePart (so that it will not move without a force other than gravity), parent a BodyForce to it with a BodyForce.Force property of Vector3.new(0, workspace.Gravity * part:GetMass(), 0), assuming part references the BasePart.

This works because W = m * g, so we're effectively applying a force equivalent to the weight of the part against its natural force of weight, resulting in a balanced force.

You can then apply any other required forces on top of this.

1
Wow, thank you so much! xEiffel 280 — 5y
Ad

Answer this question