This is something that haven’t been talked about, figured I would make a post about it.
I’ve already made a dash system; however, how can I rotate the HumanoidRootPart when pressing A, S, or D? When not in shift lock, it acts weird. Let me know if there are better methods than rotating.
local lookVector = Character.PrimaryPart.CFrame.LookVector
local multiplier = 150
local velocity = Vector3.new(lookVector.X, 0, lookVector.Z)*multiplier
Oh it seems this isn’t what you wanted, that code is to dash in the direction the player is currently heading to. Could you explain what you want exactly? Recenter the camera to where they’re dashing?
Here would be the correct code (if you want to explore this dash system, it might be better):
provided that you have the player’s dash direction as a lookvector, you can face them using a BodyGyro like so:
local bg = Instance.new("BodyGyro",character.PrimaryPart)
bg.MaxTorque = Vector3.one * 9e9
bg.CFrame = CFrame.new(Vector3.zero,dashDirection)
-- bg.P and bg.D can be adjusted for a different effect
bg.D = 1
bg.P = 3000
local attachment = Instance.new("Attachment",char.PrimaryPart)
local aligner = Instance.new("AlignOrientation",char.PrimaryPart)
aligner.Attachment0 = attachment
aligner.Mode = Enum.OrientationAlignmentMode.OneAttachment
aligner.RigidityEnabled = true -- for some reason rigidity is still smooth, no idea what's up with that
aligner.CFrame = CFrame.new(Vector3.zero,dashDirection)