if (Input.GetButton(“Jump”))
{
power += forceToAdd *Time.deltaTime;
Debug.Log (“Jump”);
}
if(Input.GetButtonUp("Jump"))
{
rigidbody.AddRelativeForce(Vector3.up * power);
Debug.Log ("Not Jumping");
}
}
Any idea why this isn’t working? This is in the function FixedUpdate.
It’s to make a car jump upwards when the space bar is held down and then released (to add power the longer you hold it).
It seems like it should work to me… the debug logs come up as expected so i know it’s recognising the function.
The car is controlled with forces by the way.
thanks for looking!
oops forgot to say, there are two vars for this;
var power = 0.0;
var forceToAdd = 5.0;