- Home /
Push PC down icy slope (along negative gradient)
When the player is trying to move up an ice slope they should be pushed down along a perpendicular vector to the normal of the slope.
I have this kind of working now with:
rigidbody.AddForce(Vector3.Cross(groundNormal, transform.TransformDirection(Vector3.right)));
However the "transform.TransformDirection(Vector3.right)" is only the correct vector when directly facing the slope. Any other direction and the player is pushed along the slope, and if facing down the slope you get pushed up it.
Can you think of a way to always get the correct "right" vector for the Vector.Cross function?
tried just pushing downwards but that feels terrible. Tried reducing player movement force when on a slope but as it has an ice physic material it just carries on up the slope. Probably other things that I cannot recall :) thanks for replying
Your answer
Follow this Question
Related Questions
Can you pls help me fix this rigidbody collision problem 0 Answers
Change player movement 0 Answers
Making objects slide 1 Answer
2d game - looking toward velocity for rigidbody player 1 Answer
NavAgent Speed & Rigidbody Velocity 1 Answer