0
\$\begingroup\$

I'm using PUN2 and trying to use nametag billboards for my players, but they are not facing forward correctly and I have to wait more than 20 seconds to make the name tag of player return to facing forward.

here's my code for my BillBoard Script:

public class BillBoard : MonoBehaviour
{
    protected Transform ThisCameraPlayerBillBoard ;


    private void Start()
    {
        ThisCameraPlayerBillBoard = GameSetup.GS.ThisCameraToBillBoard.GetComponent<Camera>().transform;

    }

    private void FixedUpdate()
    {
        transform.LookAt(transform.position + ThisCameraPlayerBillBoard .rotation * Vector3.forward,
            ThisCameraPlayerBillBoard .rotation * Vector3.up);
    
    }
}
\$\endgroup\$
11
  • \$\begingroup\$ It looks strange to me to do this action in FixedUpdate - usually we'd apply billboarding effects on text in LateUpdate. \$\endgroup\$ – DMGregory Feb 23 at 13:37
  • \$\begingroup\$ Hi! @DMGregory i actually change it to lateupdate method.. but the problem is still the same.. i have to wait for 20 sec to make it work for the nametag of the player.. \$\endgroup\$ – Lacus clyne Feb 23 at 13:48
  • \$\begingroup\$ and the billboard is facing like 180 degrees in the wrong direction? hope you can help me... \$\endgroup\$ – Lacus clyne Feb 23 at 13:49
  • \$\begingroup\$ Did you mean to use Vector3.back to point "back" toward the camera, instead of "forward" away from the camera? \$\endgroup\$ – DMGregory Feb 23 at 13:52
  • 1
    \$\begingroup\$ Again, that belongs in your question. Now: how do you expect the billboard to learn about this new camera after a death, if it only assigns ThisCameraPlayerBillBoard in its Start method, which is called a single time? \$\endgroup\$ – DMGregory Feb 23 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.