Question by
littlehandsomej · Jul 25, 2016 at 04:10 PM ·
javascriptjumpingjumping object
jumping once if touching the ground js
hello so im making a jump for my 3d character but when i press spacebar i can jump forever anyone know how to fix this problem heres my code
pragma strict
ar rb: Rigidbody; private var jumping = false; function Start() { rb = GetComponent.(); } function FixedUpdate () { if (Input.GetButtonDown("Jump") && jumping == false) { rb.velocity = Vector3(0,10,0); } jumping = true; }
function OnCollisionStay(){ jumping = false; }
Comment
Your answer
Follow this Question
Related Questions
How to set a limit on how high a player can jump? 1 Answer
My Player Doesn't Jump 0 Answers
How can I modify this to allow jumping with space? 0 Answers
Jump Script Not Working 1 Answer
Player looses ability to jump further right player moves. 1 Answer