void Awake() { if (ActiveController == null) { ActiveController = this; } rb = GetComponent <Rigidbody> (); rotors = new Transform[4] { frontLeftRotor, frontRightRotor, rearLeftRotor, rearRightRotor }; MotorsEnabled = false; // UseGravity = false; Forward = forward.forward; Right = right.forward; Up = transform.up; CreateCameraTex(); // transform.position = Vector3.up * 10; UseGravity = rb.useGravity; // UpdateConstraints (); rb.maxAngularVelocity = Mathf.Infinity; inputCtrl = GetComponent <SimpleQuadController> (); // dot = new Texture2D ( 1, 1 ); // dot.SetPixel ( 0, 0, Color.white ); // dot.Apply (); // Debug.Log ( "it: " + rb.inertiaTensor + " itr: " + rb.inertiaTensorRotation ); // rb.ResetInertiaTensor (); // rb.inertiaTensorRotation = Quaternion.identity; // Debug.Log ( "2 it: " + rb.inertiaTensor + " itr: " + rb.inertiaTensorRotation ); // gameObject.SetActive ( false ); // gameObject.SetActive ( true ); }
public override void OnEnter() { if (control == null) { control = SimpleQuadController.ActiveController; motor = control.controller; follower = control.follower; gimbal = control.gimbal; } }
void Awake() { ActiveController = this; rb = GetComponent <Rigidbody> (); rb.constraints = RigidbodyConstraints.FreezeRotation; if (controller == null) { controller = GetComponent <QuadMotor> (); } if (followCam == null) { followCam = camTransform.GetComponent <FollowCamera> (); } }
float _yMov = 0.0f; //Have to add f bc or else 0.0 is a double not a float // Use this for initialization void Start() { motor = GetComponent <QuadMotor>(); }