Hey,
In my script I have a function which calls another function when the requirements are met, here:
void FixedUpdate ()
{
if(rigidbody.velocity.magnitude > TakeOffSpeed)
TakeOff();
if(rigidbody.velocity.magnitude > TakeOffSpeed + 10)
Balance ();
}
What I want to happen is TakeOff() to be stopped when Balance() is called, however TakeOff() is a ‘void’ function. I have been trying to use return but I get an error, as return cannot be used on a void function!
This is TakeOff():
void TakeOff()
{
rigidbody.AddForce (0,50,0,ForceMode.Acceleration);
rigidbody.AddRelativeTorque (5,0,0,ForceMode.Force);
}
As you can see, I can’t use int or float, as it is a force not a value.
I’m not sure if I explained this very clearly, but help would be much appreciated
Thanks