Answers for "jump unity 3d"

C#
-1

unity c# jump

public int forceConst = 50;  
private bool canJump; 
private RigidBody selfRigidbody;  

void Start()selfRigidbody = GetComponent<RigidBody>(); }  

void FixedUpdate(){ if(canJump){         
  canJump = false;     
  selfRigidbody.addForce(0, forceConst, 0, ForceMode.Impulse);    
} }  

void Update(){ if(Input.GetKeyUp(Keycode.SPACE)){  canJump = true;     } }
Posted by: Guest on May-28-2021

C# Answers by Framework

Browse Popular Code Answers by Language