Answers for "2d object look at object"

C#
5

2d object look at object

Vector3 dir = enemy.position - transform.position;
float angle = Mathf.Atan2(dir.y,dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
Posted by: Guest on July-02-2020

C# Answers by Framework

Browse Popular Code Answers by Language