- Home /
This question was
closed Jan 10, 2014 at 06:59 PM by
tanoshimi for the following reason:
The Most Duplicated Question Ever
Question by
NinjaRubberBand · Jan 10, 2014 at 06:20 PM ·
booleantrue
Accesing boolean in a other script?
How can i acess the isFalling boolean in another script and check if its true or false?
pragma strict
var rotationSpeed = 100; var jumpHeight = 8;
var isFalling = false;
function Update ()
{
//Handle ball rotation.
var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
rotation *= Time.deltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
if (Input.GetButton("Jump") && isFalling == false)
{
rigidbody.velocity.y = jumpHeight;
isFalling = true;
}
}
function OnCollisionStay () { isFalling = false; }
Comment