- Home /
I want to use the current scale x of my object to help calculate my score. . .
I have animated objects in my game that have a changing "scale x" value. I want to use the "scale x" value to determine points earned by destroying that object at a specific scale (bigger "scale x" equals more points)
Here is my script:
var buck : int = 0; function OnMouseOver () { if (Input.GetMouseButtonDown(0)) //I click on the object {
buck++; //******Needs to be buck = buck + Scale X of this object******, How do I make this line utilize the scale x of this object
Destroy (gameObject);//object is destroyed
ScoreBoard.SCORE = ScoreBoard.SCORE + buck;//score is applied to my SCORE variable
} }
How do I point my script in the direction of my object's "scale x" value?
Comment
Best Answer
Answer by Mike 3 · May 25, 2010 at 03:10 AM
buck += transform.localScale.x;
alternatively
buck += transform.lossyScale.x;
which isn't local, but can go a bit wonky when oddly rotated in a parent