Health Bar - scale pivot point is central not left aligned??

Hi

Small problem…

When scaling my GUI texture it does it from the center!

I need to scale it from the left so it looks like the health bar is going down.

I have it setup as a GUI Texture and set all inset and border values to 0 and used the transform scale instead, this gives me resolution independence.

Any idea how I animate scale from its left edge and not center?

Thanks for any help
Geoff

The only way I would know how to do it would be to scale it down and then move it to the left. I don’t think you can set an anchor point for scaling, but I may be wrong.

How about :

var image : Texture;
var health : float = 10;
var maxHealth : float = 10;

function OnGUI(){
	var rect : Rect = Rect(10,10,100 * health/maxHealth ,20);	
	GUI.DrawTexture (rect , image );
}

this should do the work

Thanks guys!

Very helpful.

Geoff