Unknown Identifier maxSlope

var jumpVelocity : float = 20;
var grounded : boolean = false;

function Update ()
if (Input.GetButtonDown("Jump"))

function OnCollisionStay (collision : Collision)
    for (var contact : ContactPoint in collision.contacts)
        if (Vector3.Angle(contact.normal, Vector3.up) < maxSlope)
            grounded = true;

Error Assets/Jump.js(16,9): BCE0005: Unknown identifier: ‘maxSlope’.

I can’t get maxSlope to work


Are you borrowing this code from somewhere else? If so, please provide a reference to the original code. As for your error, maxSlope is not declared anywhere. You can solve your problem by putting something like this at the top of the file:

var maxSlope = 45.0;

I have no idea with the right value of maxSlope should be for your use.