kk93
1
Hello,
I have a player object that rotates, and I want a health bar to hover over it. When I make the health bar a child of the player object, it rotates with a player. Now, I know how to make the health bar just follow the player through scripting, but I still want to place the health bar under the player object for organization purpose.
Is there a way to achieve this?
Thanks!
You can attach a script to the object that rotates it to face the correct direction in LateUpdate(). Assuming the child starts out facing the correct direction, your code might be as simple as:
var rotation : Quaternion;
function Start() {
rotation = transform.rotation;
}
function LateUpdate() {
transform.rotation = rotation;
}
I’m not sure of your application. You may want something that billboards only on the ‘y’ axis, or something that points at the camera (rather than just has the same rotation).