EnemyUI look at main Camera

Hi,

In this lecture, you have the enemy health bar look at player at every frame:

void LateUpdate()
{
    transform.LookAt(cameraToLookAt.transform);
    transform.rotation = Quaternion.LookRotation(cameraToLookAt.transform.forward);
}

Why do you need to set transform.rotation after LookAt if transform.LookAt already allows the UI to look at player? Just curious question because I can’t tell what LookRotation is doing :slight_smile: .

Privacy & Terms