// Update is called once per frame void Update() { Vector3 vectorToTarget = target.position - transform.position; float angle = Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg - AngularTweeks.AngleOffset(this.forwardSide); Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward); transform.rotation = Quaternion.Slerp(transform.rotation, q, Time.deltaTime * rotationSpeed); }
private void Update() { Vector3 moveDirection = transform.position - _orgPosition; float angle = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg - AngularTweeks.AngleOffset(forwardSide); transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); Debug.Log(rb.velocity.magnitude); }