GUI Health Bar Tests


#21

So it is totally fine as it will only run once at load time, it should not change the FPS afterwards


#22

ohhh whoops i forgot to add it into the preload list. hahaha.

Thanks


#23

Is there a way i could somehow add this to my AssetManager?

Im thinking making it an async function then maybe i could add it somehow…

Any ideas?


#24

You will have to manage it your code, there is no custom task in asset manager, they are here to manage remote load.

You could do smthg along those lines: https://www.babylonjs-playground.com/debug.html#7EPK2H#22


#25

Hey thanks!

Although the scene._addPendingData was a bit tricky to get working, this all worked phenomenally,
Thank you @sebavan for the help!!!


#26

Sorry for the sudden jump in, I just want to mention that its something that I already have implemented in my own personal project. Atm, stuff is wonky due to new changes to babylon source but you can get many health bars updating in realtime on screen with multiple AI agents like so:

bugs1_221218

I hope it helps !


#27

Hey everyone, doing some more work on this, i noticed that when i switch around the unit types it becomes jittery.

https://www.babylonjs-playground.com/debug.html#7EPK2H#23

Any ideas how to fix that?


#28

is there a way to have the image anchored somehow? Such that its still a child(or container.addControl(image) pretty sure that is a parent child relationship) of container, however when container moves, it does not?

Maybe i should be using getParentLocalCoordinates somehow instead…:thinking:

(im currently looking for a way, havent found one yet)


#29

What do you mean?


#30

uhm i think i made a mistake, im still lookig into it. I think it is only on my game, not in the playground. What is happenning is that, im trying to this with percent instead of just reducing top by 1 each frame. However i get a jitter, as it goes down, i believe it is because im converting a float to pixels which doesnt work perfectly (from what i understand). However i tried ceiling my units and it has not helped.

Still looking into it, however i believe, it is just a floating point problem not a babylonjs problem.

Sorry for the confusion.


#31

Yeah it was just a floating point conversion to pixels problem. Fixed it by ceiling some numbers.

(i also reduced the percent to 3 decimal points)


#32

Ok problem solved then :slight_smile: