Hello,
I can’t get my character to slide down a hill properly, sort of like a skier/snowboarder. I’d really like to know why my character falls where the red arrow is. He also fell when I tried to use multiple planes in unity to simulate a slope. As soon as he got on a different plane he would die.
Here’s a gif of what happens right now. As soon as he hit the new normal he just dies…

var isGrounded: boolean = false;
var hit: RaycastHit;
var theRay: Vector3;
var currentPos : Transform;
function FixedUpdate ()
{
if(isGrounded)
{
theRay = transform.TransformDirection(Vector3.down); // Convert from local space to world space
if (Physics.Raycast(transform.position, theRay, hit))
{
transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
}
}
Debug.Log(isGrounded);
Debug.DrawRay(transform.position, theRay, Color.red);
}
function OnCollisionEnter(collision : Collision)
{
isGrounded = true;
}
function OnCollisionExit(collisionInfo : Collision)
{
isGrounded = false;
}
Fuck yeah I think I got it! The problem is my character would touch the next normal, get its position and leave the ground just enough to start spiraling out of control. I fixed it by zeroing the characters angular velocity as soon as it leaves the ground. I just had to add this little bit of code
`function OnCollisionExit(collisionInfo : Collision)
{
isGrounded = false;
// Prevent character from spiraling out of control the second it goes airborn
rigidbody.angularVelocity = Vector3.zero;
}`
I still have a lot to do like smoothing out the transition between normals and making the character only able to go forward or backward but that can wait. I’ve been trying to figure this out for 2 weeks!