- Home /
This question was
closed May 11, 2013 at 07:55 AM by
Fattie for the following reason:
The question is answered, right answer was accepted
Question by
MitchWardle · May 11, 2013 at 05:48 AM ·
error
My jump script isn't working?
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;
}
Comment
Best Answer
Answer by robertbu · May 11, 2013 at 06:07 AM
'OnCollisionState' should be 'OnCollisionStay'
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
error cs0120 1 Answer
Errors with script using Javascript. 2 Answers
Have null errors 1 Answer