Prevent rigidbody to lose speed when running up slopes (loop de loop)

Hey guys.
So for the past few days Ive been trying to make my caracter to properly run up slopes ( walls and loop de loops)
I got him align to the ground but as soon as reach an angle (90) where the player would be perpandicular to the world’s x/z plane ) he would stop moving.
The movement pattern I set up is prett simple

Direction = (h,0,v);
Direction = Camera.main.transform.TransformDirection(Direction)


rb.velocity += new Vector3(Direction.x,0,Direction.z)*Acceleration*Time.DeltaTime;


// RayCast code to get ground normal ... and rotate
transform.rotation=Quaternion.LookRotation(Vector3.Cross(transform.right,alignhit.normal.normalized),alignhit.normal);

if(rb.velocity.magnitude>0.1f)
mesh.transform.localRotation = Quaternion.LookRotation(rb.velocity,transform.up);

the mass of the rigidbody is set to 4 and the drag to 3
I tried nulling the drag and friction and this still happens…

I also noticed if I make the velocity " = "to the mesh’s transform.forward and multipliy it by a Speed float that increases/decreases depending on the input, the player would run almost fine on slopes.
But the thing is, adding to the velocity (+=) and then using it in LookRotation would save me alot of work cuz it makes the rotation smooth without using slerp and having to work around the rotation speed.

I hope someone here can lead me to the solution C:

Perhaps it’s as simple as gravity pulling you down…? Set gravity to 0 and see what happens I suppose :slight_smile:

No that’s not the problem.
And actually I realised that’s its something different.
Its not the speed that decreases.
Its actually the velocity being applied on the world x/z plane

Which means as soon as sonic is on a wall, the velocity will push him to the wall instead of moving him based on his forward.

Is there a way to rotate the velocity?

I tried using rb.velocity += mesh.transform.forwarddirection.magnitudeacceleration*Time
deltaTime;

Using that he can go up slopes (he speeds up alot though)
But for that I have to rotate him with the direction vector (aka lookrotation(direction) ) which is something in trying to avoid.

I’d like to still use rb.velocity += direction*acc and be able to apply the velocity on the forward axis of the player