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

How to prevent an object from not moving only on the y axis? (without anchoring)

Asked by 3 years ago

So I am trying to make a boat but the problem is that I can’t figure out how to make it stay at the same y position but make it able to move around on the x and z axis. The reason why I don’t want it anchored is because I don’t know any physics constraints that can move an anchored object. If someone could help me that would be much appreciated. C:

0
Sup MooImasnek 2 — 3y
0
Im bad at physics ;-; I'd recommend asking at dev forum or something there's so many pros there WINDOWS10XPRO 438 — 3y
0
You can try using a BodyPosition object, have its MaxForce set to (0, 100000000, 0), and the Position to (0, any number, 0). Y_VRN 246 — 3y

1 answer

Log in to vote
0
Answered by
sydre 229 Moderation Voter
3 years ago

You could do this by using a Body Position. With a Body Position, you can set a target position which the Body Position will try to move its parent part towards, as well as the force it is able to pull with. Set the target position as 0, y-level, 0, and then set the MabForce to 0, math.huge, 0.

In a script, it would look like this:

local part = script.Parent
local bp = Instance.new("BodyPosition")
local yLevel = 3
bp.MaxForce = Vector3.new(0, math.huge, 0)
bp.Position = Vector3.new(0, yLevel, 0)
bp.Parent = part
0
Thank you so much. C: MooImasnek 2 — 3y
Ad

Answer this question