1
Support / Re: Rotate slowly to target?
« on: November 09, 2013, 07:27:05 pm »
That makes so much more sense. Thank you very much.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Vector3 direction = player.transform.position - transform.position;
direction = new Vector3(0, 0, Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg);
transform.eulerAngles = Vector3.Lerp(transform.eulerAngles, direction, speed * Time.deltaTime);
Vector3 direction = targetPoint - transform.position;
transform.eulerAngles = new Vector3(0, 0, Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg);