I have a flight script and i want to modify it to fly to a number of waypoints and have a chase proximity.
Can you help me?
this is my script:
/*Simple Airplane Control - Free Version
This version allow you control an object like an airplane.
To use it, attach this script to the object. Configure it as you want (I recommend
the pre-configured options)
Also attach a rigidbody to the object.
You have to configure some Axes. Read the README file.
*/
//Variables
var YawSpeed = 30.0;
var TurnSpeed = 30.0;
var ElevateSpeed = 30.0;
var Acceleration = 0.1;
var MaxSpeed = 40;
private var Speed = 0.0;
function Update(){
//Limit the speed
if(Speed >= MaxSpeed){Speed=MaxSpeed;}
//Apply gravity only if the speed is 1/3 of the MaxSpeed
if(Speed <= (MaxSpeed / 3)){
rigidbody.useGravity = true;
}else{rigidbody.useGravity = false;}
//Continuous movement
transform.Translate(Vector3.forward * Speed * Time.deltaTime);
//Acceleration Deceleration
if(Input.GetAxis(“Accelerate”)){Speed = Speed + Acceleration;}
if(Input.GetAxis(“Decelerate”)){Speed = Speed - Acceleration;}
//Yaw, turn elevate
transform.Rotate(0,Input.GetAxis(“Yaw”) * YawSpeed * Time.deltaTime,0);
transform.Rotate(0,0,Input.GetAxis(“Turn”) * TurnSpeed* Time.deltaTime);
transform.Rotate(Input.GetAxis(“Elevate”) * ElevateSpeed *2 * Time.deltaTime,0,0);
}