You can write your topic however you want, but you need to answer these questions:
I’m currently working on a sliding system but the character keeps bouncing and makes it look bad any ideas on how to fix it? (I use bodyvelocity and set the velocity based on the RootPart’s lookvector I’ve tried using LinearVelocity but it didnt fix it)
It might be hard to understand this image.
Explainations
Blue circle : the point ( RootPart )
Blue arrow : lookVector of RootPart (Velocity)
Red line : The way blue circle goes when its applied lookVector velocity
Black line : slope
Mint circles : where bounces happen
Try this system that uses raycasts to make velocity match the slope of the object
while Sliding --[[Variable For Sliding]] do
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude
rayParams.FilterDescendantsInstances = {RootPart.Parent}
local raycast = workspace:Raycast(RootPart.Position, Vector3.new(0,-3.5,0), rayParams)
local Rotation : CFrame
if raycast then
if raycast.Normal ~= Vector3.new(0,1,0) then
Rotation = CFrame.new(Vector3.zero, raycast.Normal)*CFrame.fromOrientation(math.rad(90),0,0)
else
Rotation = RootPart.CFrame.Rotation
end
else
Rotation = RootPart.CFrame.Rotation
end
GroundSlideVelocity.Velocity = Rotation.LookVector * CurrentSlideSpeed
wait()
end
If his idea doesn’t solve the problem, then I have another prompt for the solution:
The bouncing might be due to the character colliding with the ground. When using BodyVelocity, the character’s velocity is changed instantly, which can cause it to collide with the ground and bounce. Like what @TheESPPlayerSeemoney pointed out.
One way to fix this is to use BodyPosition instead of BodyVelocity. BodyPosition moves the character towards a target position smoothly, which can help prevent bouncing.
This will move the character in the direction it’s looking at a speed determined by CurrentSlideSpeed.
Another thing you can do is to adjust the Friction property of the character’s parts. A higher friction means the player sliding more, and a lower friction means the player sliding less (if that makes any sense).
If this doesn’t solve the problem, then I’m gonna need more details like how CurrentSlideSpeed is calculated.
First off, the BodyVelocity instance is deprecated, and you should use something like a LinearVelocity instead. This video I found talks a bit about this issue with moving down slopes, and the way they fix it is by snapping the player down if the distance is small enough
(They talk about it at time 5:00)
Image explaination:
Black line = slope
Blue circle = the part sliding
Purple arrow = Look Vector (of blue circle)
Green arrow = the velocity of LinearVelocity (Vector3.new(0,-x,0))
Blue arrow = the direction blue circle actually goes when all the forces combined
Red line = The way blue circle goes when its applied lookVector and linearVelocity (0, -x, 0)
( x is unknown, you should adjust it )