- Home /
position and scale ratio;
I was doing a program that enables an object to change its size to a certain number so I use transform.localscale.y and at the end of this object connect an object but when I connect the object by changing its position using transform.position.y equal to that of the scale, the does not intersect at any point in space. I think there is a ratio for the two or my program is wrong. May I ask for some suggestions for this.Thanks.
transform.position.y is deter$$anonymous$$ed in global space, transform.localScale is local. What exactly are you trying to do here? Are you trying to scale an object, and keep something at its outer edge?
yes, I'm trying to scale an object and attach another object in one of its ends by changing the second's object position.Does that mean to achieve my goal, I must put the position in local space or put the scale into global space?
Answer by Eric5h5 · Nov 16, 2011 at 04:38 AM
A simple way to do this without needing to figure out any math is to create an empty transform, make that a child of the object, and position it at the edge of the object. When the object is scaled, the empty transform child will go with it. So you can use the global position of the empty transform.
I don't fully understand this. Sorry I'm a new user of this program. I'm actually using two prefabs and I want to scale the first prefab depending on the second prefab and it's clones(by instantiating).
Not an answer to what I'm looking for either, but it DOES point me in the right direction on something else. Good idea.
EDIT: Actually, I changed my $$anonymous$$d, it does answer what I'm looking for! I was just trying to figure out the dimensions of a GameObject... so I took your advice plus added another empty GO in the opposite corner. Boom.