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

How do I fling a player at an angle using this Vector?

Asked by
Romul 21
5 years ago
Edited 5 years ago

I have the below code for flinging the player forward. It works flawlessly. The problem I'm having is now I want to apply an upwards angle so that the player moves forward and upwards when this is applied. How would I go about doing this? Thanks!

local position = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart)
position.MaxForce = Vector3.new(50000,50000,50000)
position.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector*50
0
So you want a sort of arc? ffejyos 10 — 5y
0
Basically Romul 21 — 5y
0
I solved the issue, thanks for your interest in helping ffejyos! Romul 21 — 5y

1 answer

Log in to vote
0
Answered by
Romul 21
5 years ago

I fixed my own problem again. lol I probably should just delete the post, but I'd like to post the resolved problem for future reference for others! I just wish I could rank up my own answer as the solution.. Basically, the Y axis was 0 when I applied the change to the lookVector, so when I added 60 to that axis after the change, it pushed me up as well. The following code thrusts the character forward and upward, basically an arc kind of jump.

local position = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart)
position.MaxForce = Vector3.new(50000,50000,50000)
position.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector*100+Vector3.new(0,60,0)
game.Debris:AddItem(position,1.25)
Ad

Answer this question