How to make bodyvelocity move with the players camera

Hey, I’ve been looking for solutions to this problem for the past couple days but I can’t seem to find a solution.

The issue is that I’m using a bodyvelocity to move the player when they dash, however rotating the player/camera mid dash doesn’t move the bodyvelocity with it.

Example:

What happens (if you cant see the video):

What I want to happen:

This is how i made it:

local BV = Instance.new("BodyVelocity", char.HumanoidRootPart) 
BV.MaxForce = Vector3.new(calculatemaxforce(10,char), 0, calculatemaxforce(10,char))
BV.Velocity = hum.MoveDirection * 24.7

game.Debris:AddItem(BV, 0.5)

I also tried looping the creation of the bodyvelocity which did work somewhat but it became very laggy and kept teleporting my character back

Thanks

1 Like

You can update the Velocity every frame (recommending to move the script to client so it doesn’t lag the server)

Keeping to loop the creation of the bodyvelocity sounds wrong cause u have multiple velocitys so thats why it lags…
only thing i could think of for the solution is that after u create ur velocity, do multiple updates to that velocity quickly…
now i dont know how this calculation works that u have done
BV.Velocity = hum.MoveDirection * 24.7
but i think it like this:

local BV = Instance.new("BodyVelocity", char.HumanoidRootPart) 
BV.MaxForce = Vector3.new(calculatemaxforce(10,char), 0, calculatemaxforce(10,char))

game.Debris:AddItem(BV, 0.5)

local updates = 0
while updates < 40 do -- 40 is for how many frames we update it
   BV.Velocity = hum.MoveDirection * 24.7
   updates += 1
   game.RunService.Heartbeat:Wait()
end

or make that for loop every frame like the other guy said…¨
yeah that gotta be better

Yeah, I tried this, however the player has to actively move for the updates to work, I want a dashing system where u can choose to let go of your w/a/s/d keys after dashing and have it still follow the players rotation

Don’t worry! I solved it by creating an initial movedirection then looping a lookvector

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.