can’t get character to only jump once new to scripting the point of the script was for him
to jump then reset jump to 0 so he couldn’t jump twice in the air but it only resets one time
the character has rigidbody on with continuous dynamic and a capsule Collider and the
ground has a terrain collider i just cant get the script to tell when he in the air reset
jump to 0. i ran a debug log it tells everytime he hits gound it just wont detect when he in the air been up hour trying to figure it out
please help
public var jump:float=0;
public var jumpheight :float=20;
function Update ()
{ if (Input.GetKeyDown (KeyCode.Space))
{transform.Translate(Vector3.up * (jump) * Time.deltaTime, Space.World);}}
function OnCollisionStay(collision : Collision){
if (( collision.gameObject.tag==("Ground") ))
{(jump)=(jumpheight);}
else {(jump)=(jump);}