Linearvelocity problem

Hi @Deimesa, I appreciate your “preachy” explanation of my problem! However, I’ve actually found an alternative way to counteract “player being too slidey” and “player getting stuck on the wall”. I feel kinda bad because of the amount of information you’ve provided me but the solution was easier than you think. Don’t worry I’ll be explaining what I’ve done to achieve it. But firstly,

I am making this custom movement to make a fully functional parkour movement game, similar to Parkour Reborn and Orion Protocol, but I am currently leaning more towards Orion Protocol because of the realism.

The slidey issue:

The code:

local linearVelo = Instance.new("LinearVelocity", rootpart)
linearVelo.Attachment0 = rootAttachment
linearVelo.MaxForce = 800
linearVelo.VelocityConstraintMode = Enum.VelocityConstraintMode.Plane
linearVelo.RelativeTo = Enum.ActuatorRelativeTo.World
linearVelo.PrimaryTangentAxis = Vector3.new(1, 0, 0)
linearVelo.SecondaryTangentAxis = Vector3.new(0, 0, 1)
bindToRenderStep("Movement", 1, function(step)
	local moveDir = hum.MoveDirection
	local targetVelo = Vector2.new(moveDir.X, moveDir.Z) * maxSpeed
	local deltaVelo = targetVelo - linearVelo.PlaneVelocity
	linearVelo.PlaneVelocity += deltaVelo * 2.5 * step
end)

This is mainly the problem I have with my custom movement system, but through some experimentation and messing around with the code, I’ve merely just adjusted
the 2.5 value in relative to the linearVelocity Magnitude.
It goes something like:

local targetVelo = Vector2.new(moveDir.X, moveDir.Z) * maxSpeed
local deltaVelo = targetVelo - linearVelo.PlaneVelocity
local increment = lerp(1, 6, math.clamp(linearVelo.PlaneVelocity.Magnitude/21, 0, 1))
linearVelo.PlaneVelocity += deltaVelo * increment * step

This is the result:


As you can see, compared to the original thread’s video, it’s must less slidey - especially when the player is turning.

The “player getting stuck on the wall” issue:

The reason why I am making a capsule collider in the first place is that when the player is performing parkour movements, the default character’s collision may affect god knows what.

Indeed, it was the mover constraints that were causing this issue, and until now I still have no clue why and how it happened, but through some research in the DevForum I came across this post:

Similarly, all I did was detect the parts within my radius and then raycasting to get the normal, then feel it into:

local function reflectiveForce(ray)
			if ray and (ray.Instance.CanQuery or ray.Instance.CanCollide) then
				local normal = ray.Normal
				local reflection = moveDir - 2 * moveDir:Dot(normal) * normal -- Reflection=Incident−2×Incident⋅Normal×Normal
				linearVelo.PlaneVelocity = Vector2.new(reflection.X, reflection.Z) * moveDir.Magnitude * 2.5
			end
		end

Here is the result:

As for:

I’ve also utilise CustomPhysicalProperties! I check if the player is falling then apply more to the HumanoidRootPart’s density.

Once again, thank you for your comments and your help. Sorry for not informing you that this problem was been solved long ago, I thought no one was gonna come back to this thread lol.

6 Likes