BillboardGui Positioning

Hi, I am trying to position a BillboardGui for an ‘Overhead Healthbar’ system in my game, but when I attempt to do so, it has positional errors.
On my character (Localplayer), it looks fine:
image
The problem is though, that when it is parented to another character (say a dummy for example), the position is Off-Centered, Here’s what I mean:
image
This probably happens because I have the StudsOffset property in the BillboardGui set to Vector3.new(0, 0, 0.8). The reason I have it set to this, is so that accessories don’t overlap the BillboardGui but walls in front of the character will. I do not want to use AlwaysOnTop as it renders the BillboardGui over EVERYTHING, and not just accessories on the character.
image
What I want to achieve (The position isn’t centered when you get close but in this screenshot it looks like it is):
image
Any help is appreciated.

3 Likes

Have you tried setting your GuiObject.AnchorPoint to 0.5, 0?

Yes, the BillboardGui has a Frame which houses everything else.
image

image

1 Like

Assuming the script handles the replication of the overhead UI to other characters in-game, can I see how it handles replication?

There is a server script which parents the Healthbar to any player character that spawns in, It also has events to pick up health changes, etc.

The replication is fine, the position on the client for every single BillboardGui on every other character is what I’m worried about.

Here’s what it looks like on my character, as you can see it is centered.
image
And doesn’t clip in front of walls, etc
image
When I parent it to another character, however, that’s when the problem begins.


Games like VERTIGO don’t have this positional issue where it is not centered.

Can you try testing it with actual players? (Ex. Client And Servers under Test)

I have actually tested it with an actual player (being my friend) yesterday, when I encountered that issue for the first time. That’s why I’m posting about this anyway, also I don’t think it would make a difference testing it with actual player characters because they’re practically the same as Dummies.

What I’m getting here (correct me if im wrong), is that when the PlayerAdded event fires, the script replicates the overhead health ui in the pos without applying the offset? It’s only on the succeeding times it fires does it apply the offset.

PlayerAdded x1 > Replicate Overhead UI > Neglect offset
PlayerAdded x2 > Replicate > Apply offset

You can compare this by looking at the comparative difference between the two photos, or the position of the two uis under each of the two distinct characters.

This is unless, as you’ve said before, the GuiObject.StudsOffset was set to Vector3.new(0,0,0.8) before any replication took place.

The position of the BillboardGui is rendered relative to the camera on the client. On my character the Billboardgui is centered because the camera revolves around it, but it is offset when compared to other characters that the CameraSubject of workspace.CurrentCamera isn’t set to.

1 Like

Would hardcoding setting the StudsOffset in the script change anything?

1 Like

No, I don’t think so. Replicating the ui with a StudsOffset property of 0, 0, 0.8 vs. hardcoding the StudsOffset property into the server script wouldn’t make much of a difference. The Parent of the billboard ui is set to the Player.Head position, correct?

The BillboardGui is parented to the head and the Adornee is also set to the head.

Just to confirm, there is no positional difference between LocalPlayer and Player overhead UIs? If so, it could be, as you said, because of the CameraSubject

It doesn’t matter if the character belongs to a Player or LocalPlayer, If the camera doesn’t revolve around a part and the StudsOffset is something like 0, 0, 0.8 then it’s going to be offset relative to the Camera’s Cframe on the client and not centered. If the camera revolves around a character or the part the BillboardGui is in then it’s going to be centered because the camera is centered to the character.

For extra context,
The StudsOffsetWorldSpace property is set to 0,1,0 so it is 1 Stud above the head.

1 Like

I believe that’s where your issue lies, you had pointed it out yourself that if the uiObject isnt the CameraSubject of workspace.CurrentCamera, then it appears so that the ui is offset in a way that wasnt intended.

Yes, that’s what I’m getting at. But how would I resolve the issue?

1 Like

I haven’t really familiarized myself with the Camera object as much as I’d like, so my solution could be really rudimentary. Maybe you could adjust the Y.Offset so that any accessory wouldn’t overlap it and lower or set Z.Offset to 0?

I don’t think setting the Y position to a higher value would fix it

1 Like