Help with a floating health bar's positioning

Hi @ljw8419lj

like already said, you don’t explain how and what you are trying to do exactly.

“I’ve succeeded in it but it doesn’t work as well as it does on video.”

I see two similar videos, is one yours and another by someone else?

“I want to make a floating health bar.”

I guess you are trying to place health bar on UI system’s Canvas? You could do this in several ways. If you use UI system, you could have one canvas for each health bar above characters for world space health bars, but based on your video it looks like you want to create screen space health bars?

World to viewport conversion of position isn’t enough as UI system elements reside in RectTransform’s coordinate system, and each RectTransform is parented eventually under Canvas (topmost RectTransform with Canvas + Canvas Scaler). You need to also do conversion from viewport to local point in RT, if you want to place health bars above characters in screen space canvas.

These threads might help you get started:

1 Like