Homing Missile Part 2
How to rotate the missile towards the target
Jun 30, 2021
Script Rotate Missile to look at the Target
To achieve this we use the following function to calculate the angle.
We add the following code in our HomingMissile script in the Update() method.
float angle = Mathf.Atan2(_direction.y, _direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);