// Update is called once per frame void Update() { if (forceMultiplier != speed.GetForceMultiplier()) { forceMultiplier = speed.GetForceMultiplier(); } // Get the look at rotation between positions of player and cursor using up as a pivot Quaternion rotation = Quaternion.LookRotation(cursor.transform.position - transform.position, transform.TransformDirection(Vector3.up)); // rotate around z transform.rotation = new Quaternion(0, 0, rotation.z, rotation.w); }
// Use this for initialization void Start() { speed = GameObject.FindGameObjectWithTag("Speed").GetComponent <SpeedManager>(); rBody = GetComponent <Rigidbody2D>(); forceMultiplier = speed.GetForceMultiplier(); }