// Initial basic initialization private void Awake() { engine = null; rb = null; turnRate = 0f; rollDeg = 0f; throttle = 0f; }
// Gets the component references and initiales the heading. void Start() { heading = gameObject.transform.rotation.eulerAngles.y * Mathf.Rad2Deg; desiredHeading = heading; engine = GetComponent <ShipThrustComponent>(); rb = GetComponent <Rigidbody>(); rb.useGravity = false; rb.constraints = RigidbodyConstraints.FreezePositionY; }