- Home /
 
Constant Force doesn't work
I want to have 2 constant forces going at the same time in my game. If I tweak the values in the inspector while the game is running, I'm able to have the effect I want. Can someone tell me what's wrong with my script? It's as if it completely ignores the first if statement. Thanks!
 private var rotateSpeed : float = 0.0; private var flipSpeed : float = 0.0; var speedness : float = 20.0;
 
               function StartSpinning () { 
 constantForce.relativeTorque = (Vector3.up  rotateSpeed  Time.deltaTime); }
 
               function StartFlipping () { 
 constantForce.relativeTorque = (Vector3.forward  flipSpeed  Time.deltaTime); }
 
               function Update () { if (Input.GetKey("left")) { rotateSpeed = speedness; StartSpinning(); 
 } 
 if (!Input.GetKey("left")) { rotateSpeed = 0; StartSpinning(); } 
 if (Input.GetKey("up")) { flipSpeed = -speedness; StartFlipping(); 
 } 
 if (!Input.GetKey("up")) { flipSpeed = 0; StartFlipping(); }
 
                }
  
              Your answer