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.