Hi. I am looking for help with a problem. Enemy bullet has the right rotation when player is on the left side of the enemy but goes “Look Rotation Viewing Vector Is Zero” and disappers when he is on the right side.
my code is as follows.
Vector3 relativePos = target - transform.position;
Quaternion rotation = Quaternion.LookRotation(relativePos);
rotation.x = transform.rotation.x;
rotation.y = transform.rotation.y;
transform.rotation = rotation;