So, I’m obviously looking to have my character (which is a rigidbody) stick to slopes when descending. I’m aware that this is a common problem and that there are a myriad of different solutions, however none of which I’ve read have seemed optimal.
It would seem to me that the best way to approach this is to have movement during a collision be based on the collision normal. So what I’ve essentially done is have the character get the normal in the event of a collision, and then use Vector3.Cross to compare it to the input direction, thus moving the character along the plane.
This works great when on a single face, but as soon as you get to an edge, the collision normal differs from the face’s normal.
And thus, the cross-multiplied input vector sends the character off the edge, causing it to appear to bounce when gravity is applied.
I suppose my real question here is: is there an easy way to instead of getting the collision normal, to get the normal of the face you’re colliding with? That would seem to me to be the optimal solution to this issue. I’m fairly new to Unity, so any and all opinions are welcome and appreciated. Thanks.