How do you create a dash dependant on where the camera is facing, rather than where the humanoidrootpart is? To elaborate, when the character is mid dash, the dash changes course depending on where the camera is facing.
Example of what I want to achieve:
In the gif, it shows the characters dash direction changing because the camera is changing direction; how do you recreate this?
I don’t like using body velocities because when your character has momentum or is in the air the dash distance changes. At the moment i’m using bodyposition which always go to the same direction regardless of the camera.
Heres what I tried:
function Dasha(root)
local camera = workspace.CurrentCamera
local direction = camera.CFrame.RightVector * -25
local bp = Instance.new('BodyPosition')
bp.MaxForce = Vector3.new(30000,0,30000)
bp.P = 100000
bp.D = 2500
bp.Parent = root
bp.Position = Vector3.new(direction.X, 0, direction.Z)
game.Debris:AddItem(bp, .18)
end
The script above tries to dash to the left, but simply goes into seemingly random directions each time.
I used this post for reference on the above script:
I’m not too familiar on this topic. However, just from what I can think of it would be difficult without BodyVelocity. But you could take it as something similar to rayCasting a bullet?
It which you constantly loop the movement, taking fps into account. It’s hard to explain, and is a bit complicated to type out here. Basically you’re putting it into a loop, that moves the Player in that direction ever so slightly, taking the CFrame and altering the direction every milisecond. So it might look something like this :
for i = 0,25 do
local camera = workspace.CurrentCamera
local direction = camera.CFrame.RightVector*-1
#And so on
Might be something like that, but most likely not.