I'm trying to get the character to jump, is it because the trigger key hasn't been inputed correctly?
This is the code I'm using
pragma strict
var rotationSpeed = 100 var jumpHeight = 8; private var isFalling = false;
function Update () { //Ball rotation. var rotation : float = Input.GetAxis ("Horizontal") rotationSpeed; rotation = Time.deltaTime; var rigidbody: Rigidbody = gameObject.GetComponent(Rigidbody) as Rigidbody; GetComponent. ().AddRelativeTorque (Vector3.back * rotation);
if (Input.GetKeyDown(KeyCode.Space) && isFalling == false)
{
rigidbody.velocity.y = jumpHeight;
}
isFalling = true;
} function onCollisionStay () { isFalling = false;
}
I'm working on my coding skills and I've tried just about everything I know, outside of rewriting the entire thing and no one else could figure it out. I was wondering if someone here could show me the fix.
Answer by synjaqt · Feb 01, 2017 at 02:25 AM
Okay Im not sure what I did, but I fixed it by adding a second code which was basically me just goofing off
Your answer
Follow this Question
Related Questions
How do i make character JUMP? 1 Answer
Make a rigidbody Jump (global up) 3 Answers
Multi-touch buttons 0 Answers
rigidBody.addforce doens't work like i want it to 1 Answer
This is frustrating 2 Answers