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

How to make BodyVelocity maxforce only forward based on lookVector?

Asked by 3 years ago

I want to make a BodyVelocity that will go forward but the MaxForce should only be forward, so I can move left and right but it still propels me forward. The issue is I don’t know which axis is forward so I can change the MaxForce.

I tried just giving the root velocity but for some reason, it didn’t work at all. I did this before: Root.Velocity = Root.Velocity + Root.CFrame.lookVector * 12

    local BodyVelocity = Instance.new("BodyVelocity")
    BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 12
    BodyVelocity.MaxForce = Vector3.new(1e5, 0, 1e5) -- Here is the part I don't know how to fix to make it only go forward and not left and right 
    BodyVelocity.Parent = Player.Character.HumanoidRootPart 
    Debris:AddItem(BodyVelocity, .3)
0
FYI: LookVector is spelled with uppercase L and uppercase V rabbi99 714 — 3y
0
Not true you can do it with both eecoolboyee 0 — 3y

Answer this question