Unity Avion Script

Jun 24th, 2013
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var speed=0;
  2. var Torque=10;
  3. var Gravity=100.0;
  4. var acceleration=2;
  5. var maxspeed=1200;
  6. var minspeed=0;
  7. private var SavedGravity=0;
  8. SavedGravity=Gravity;
  9. function Update(){
  10. if(speed >= maxspeed)speed=maxspeed;
  11. if(speed<=minspeed)speed=minspeed;
  12. if(Input.Getkey(KeyCode.W))speed=speed+1*acceleration;
  13. if(Input.GetKey(KeyCode.S))speed=speed-1*acceleration;
  14. ConstantForce.RelativeTorque.y=Input.GetAxis("Yaw")*Torque*2*Time.deltaTime;
  15. ConstantForce.RelativeTorque.x=Input.GetAxis("Vertical")*Torque*Time.deltatime;
  16. ConstantForce.RelativeTorque.z=-Input.GetAxis("Horizontal")*Torque*Time.deltatime;
  17. Gravity=SavedGravity-speed;
  18. ConstantForce.Force.y=-Gravity/100;
  19. if(Gravity<=0)Gravity=0;
  20. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.