Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var speed=0;
- var Torque=10;
- var Gravity=100.0;
- var acceleration=2;
- var maxspeed=1200;
- var minspeed=0;
- private var SavedGravity=0;
- SavedGravity=Gravity;
- function Update(){
- if(speed >= maxspeed)speed=maxspeed;
- if(speed<=minspeed)speed=minspeed;
- if(Input.Getkey(KeyCode.W))speed=speed+1*acceleration;
- if(Input.GetKey(KeyCode.S))speed=speed-1*acceleration;
- ConstantForce.RelativeTorque.y=Input.GetAxis("Yaw")*Torque*2*Time.deltaTime;
- ConstantForce.RelativeTorque.x=Input.GetAxis("Vertical")*Torque*Time.deltatime;
- ConstantForce.RelativeTorque.z=-Input.GetAxis("Horizontal")*Torque*Time.deltatime;
- Gravity=SavedGravity-speed;
- ConstantForce.Force.y=-Gravity/100;
- if(Gravity<=0)Gravity=0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement