Before I show the code, I would like to explain I did try to fix it and my fix worked kind of, but caused other errors to show up and I just didn’t feel like typing all of the errors out on here and I already know it wasn’t the right kind of fix I needed.
Anyways, here is the code I used
#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.<Rigidbody> ().AddRelativeTorque (Vector3.back * rotation);
if (Input.GetKeyDown(KeyCode.Space));
{
Rigidbody.velocity.y = jumpHeight;
}
isFalling = true;
}
And the error that showed up is “An instance of type ‘UnityEngine.Rigidbody’ is required to access non static member ‘velocity’”