- Home /
How to I make ui in world space look at the player?
I feel like I'm over thinking it, but I'm tryinto make an enemy health bar that hovers above the enemies head and looks at the player. The problem is, the health bar rotates in weird directions, and if the enemy rotates the health bar rotates with it. How Dow I make it always look at the camera regardless of its parents rotation?
Comment
Best Answer
Answer by cbjunior · Jun 25, 2017 at 03:02 PM
When you modify the rotation of the health bar object, which I'm assuming is a child of the enemy object, you need to make sure that you set the rotation separately from the parent object. You should be able to use the transform.LookAt (Transform target)
function to rotate the health bar to face the player object.