- Home /
2D top-down worldspace health bar snapping to camera, not entity
Hello! I am making a 2D top-down shooting game in which you control a boat and shoot other boats. Currently there is 1 Enemy Boat. I am trying to implement a Health Bar as in Brackey's tutorial on health bars, and am running into an issue trying to snap the enemy health bar to the enemy boat. I have a Canvas in World Space with the health bar in it attached to the enemy Boat (the Enemy being the parent of the Canvas) and, whilst it does rotate with the Enemy Boat, the Health Bar is remaining positioned relative to the camera, not the Enemy Boat. How do I set it to actually follow the Boat's position, not the camera's?
I faced similar kind of issue last time, I am still searching for some proper solution.
can you go in a lil more detail about the problem, then maybe we can help you out
Answer by davidrex25 · Jul 03, 2021 at 01:58 PM
okay, just in case anyone finds this. i stopped using a slider and am instead using a gameObject sprite for the health bar. if there is a solution to the original problem that uses canvas i would love to know though!
can you provide a lil more detail about the issue....for example your code and stuff....
Answer by Scottrichards00 · Jul 09, 2021 at 03:57 AM
It is great to see that some people still put in an effort into managing their websites.