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

How to make BodyVelocity only go in one direction ignoring the other directions?

Asked by 5 years ago
        local Body = Instance.new("BodyVelocity",character.Torso)

        Body.Velocity = Vector3.new(0,25,0)

This will be hard to explain but but I want to use body velocity only in the Y direction. Something like the code above but it just ignores the z and x directions. When using (0,25,0) it does not allow you to move while going up.

0
To reexplain I want my character to move up for a certain amount of time while still being able to move freely in the z and z directions. dracefiery 4 — 5y
0
Set the first and third parameters for `MaxForce` to `0`. `MaxForce = Vector3.new(0, 25, 0)` TheeDeathCaster 2368 — 5y
0
I am still really struggling with this, so I would have to set the MaxForce to 0 for the x and z? Will this allow me to still move while going up and how would I set them. dracefiery 4 — 5y
0
My new code might work? OBenjOne 190 — 5y
0
very sorry that it did not work at first D: OBenjOne 190 — 5y

1 answer

Log in to vote
-1
Answered by
OBenjOne 190
5 years ago
Edited 5 years ago

you could use regular velocity instead. I think that is what body velocity does anyway?

I have heard tell that regular velocity is hard to work with but have never experienced that myself.

Hope this helps!

EDIT2: My code did not work, something else you could try

while (your condition for flight is met) do wait ()

local Body = character.Torso

Body.Velocity = Body.Velocity * Vector3.new(1,0,1) -- sets the Y to 0
Body.Velocity = Body velocity + Vector3.new(0,25,0) -- increases it to 25 essentially setting Y to 25?

end

Please let me know if this method works, If it doesn't then I will remove my answer, (but really this should work now)

0
Velocity.Y gets only the up/down direction (think of a Vector3 value as Vector3.new(X,Y,Z)) OBenjOne 190 — 5y
0
If this helps, accept answer :D OBenjOne 190 — 5y
0
I didnt think about using Body.Velocity.Y, thanks! dracefiery 4 — 5y
0
I keep getting the same error when I try using that "Y cannot be assigned to" dracefiery 4 — 5y
View all comments (2 more)
0
The `X`, `Y` and `Z` axis's are read-only; to edit them, you have to use a `Vector3.new`. `Velocity = Vector3.new` TheeDeathCaster 2368 — 5y
0
the pain of a -1 answer OBenjOne 190 — 5y
Ad

Answer this question