Hi everyone
So this is what I try to do: enable / disable the movement of my plane; I setup 2 input buttons for this and proceeded next;
var EngineOn = false;
var EngineOff = false;
function FixedUpdate () {
if(Input.GetButton("StartEngine"))
{
EngineOn = true;
EngineOff = false;
rigidbody.AddRelativeForce(0, 0, normalizedSpeed * forwardForce);
//.. and so on
}
if(Input.GetButton("StopEngine"))
{
EngineOn = false;
EngineOff= true;
rigidbody.AddRelativeForce(0, 0, 0);
//.. and so on
}
Currently this works just fine with a twist - unless I keep the button pressed, the command turns off.
I don't know how offensive that is to decent programmers out there but this is how an artist sees the code :) What I try to do is enable the bit of code that does all the acrobatics with my gameObject and simply disable that bit of code when the engine is not running; So, in how many ways I am wrong with this approach?
Thanks in advance,