My jump script isn’t working if anybody could tell me why and how to fix it that would be great
//The Script
var jumpVelocity : float = 800;
@HideInInspector
var grounded : boolean = false;
var maxSlope : float = 60;
function Update ()
{
if (Input.GetButtonDown("space") && grounded)
rigidbody.AddForce(0, jumpVelocity, 0);
}
function onCollisionState (collision : Collision)
{
for (var contact : ContactPoint in collision.contacts)
{
if(Vector3.Angle(contact.normal, Vector3.up) < maxSlope)
grounded = true;
}
}
function onCollisionExit ()
{
grounded = false;
}