So im trying to make a sliding mechanic similar to bo3 sliding. I am using AssemblyLinearVelocity to give an initial boost in the direction the player is currently facing but they keep stopping immediately after the initial boost instead of slowly losing speed. I have tried multiple things to fix this but the only thing i found that worked was BodyVelocity which is deprecated :/ I am also trying to get the player to follow slopes when using the slide ability instead of flying off them, which I thought I could do with raycasting but when I try to teleport the player to the raycast hit position + hip height + 1/2 root part size the player model stops aligning with the camera and just starts rotating and moving seemingly randomly every time i slide.
tldr
- how to make the player slowly lose speed instead of stopping immediately after setting AssemblyLinearVelocity
- how to properly teleport player down to where the raycast hits so their model doesnt fly off into the stratosphere
the slide function:
if value and not exhausted and not sliding then
sliding = true
_sprint(false)
slide_anim:Play(0.25, 1.0, 1.0)
stamina = math.max(0, stamina - slide_cost)
if stamina == 0 then
_setExhausted(true)
end
_updateStaminaUI()
slide_velocity = Vector3.new(root_part.CFrame.LookVector.X * 100, 0, root_part.CFrame.LookVector.Z * 100)
humanoid.WalkSpeed = 0.0
root_part.AssemblyLinearVelocity = slide_velocity
slide_time = 2
else
sliding = false
slide_anim:Stop(0.25)
humanoid.WalkSpeed = walk_speed
end
end```