I’m creating a third person character controller, and I’m adding handling for “sliding” (where the character will slowly fall down a slope). Problem is, the normal of the y-axis is returning 1 regardless of where I stand in my world - whereas it should be returning something between 0 and 1 when I’m on an inclined surface.
My character is currently a capsule (with the Character Controller), and my ramp is currently a box at an angle (with a Box Collider) - have I forgotten something really basic?
RaycastHit hitInfo;
if (Physics.Raycast(transform.position + Vector3.up, Vector3.down, out hitInfo))
{
//I've put debug logs here, to confirm normal.y's value
if (hitInfo.normal.y < 0.9f;) {
slideDirection = new Vector3(hitInfo.normal.x, -hitInfo.normal.y, hitInfo.normal.z);
// It's never coming in here!!! Q_Q
}
}
Occasionally, while on flat terrain, the normal will randomly spike to numbers between 0.5 and 0.9.