Hi guys! So I have a problem with my player GameObject. Every time I do my "Jump" command at the **start of the game,** it manages to jump ridiculously high. But after that, it starts jumping normally again. Is there some way I can prevent that from happening? Thank you in advance. Oh, and here's my "Jump" command script:
var Jumped = false;
var JumpHeight = 7500f;
function Update ()
{
if(Input.GetKey(KeyCode.Space) && !Jumped)
{
Jumped = true;
rigidbody.AddForce(Vector3.up * JumpHeight * Time.deltaTime);
}
}
And here is what I use to prevent jump spamming, its connected with the code above.
function OnTriggerStay ()
{
Jumped = false;
}
What I've also noticed is that upon starting, the GameObject has a Y coords of 0. But, after the jump, it becomes around -0.00002
↧