Some questions about forward vector and LookingAt script

Hello everyone. I’m very new in Unity engine and there is a lot of things i dont understand. I was looking for some tutorials and i found the gold content which is Brackeys YT channel. There was a film about health bar and i dont fully understand how one script works.

  • around 18:25.

So this script is pointing object towards camera’s transform.forward vector. But i don’t understand how it works in practice. Could you please explain me what are the values of which vectors so i would know why we are adding position to the forward vector.

That’s the script.

public Transform cam;

LateUpdate
{
transform.LookAt(transform.position += cam.forward);
}

There is one more question about transform.forward which is Vector3.forward * transform.rotation (?) i belive. If i am correct there is (0,0,1) value * some rotation. So, this mean the transform.forward is always (and only) pointing at Z axis ?

This is so confusing for me, i will be thankfull if someone will try to explain it to me. I think this is so easy but i complicate too much things.
Sorry for any english logic/grammar mistakes. It’s not my native language and i didn’t used it for a long time.

When you use LookAt() that means “make my +Z axis (forward) point here” (wherever position you give it).

The point of this is so if you have a healthbar it will always face to the camera.

This is called “Billboarding”

Here is another video that describes it perhaps a different way: