- Home /
Question by
Jordan Miller 2 · May 07, 2010 at 03:14 AM ·
scale
Scale Objects become flat.
I'm unable to scale an GameObject correctly. The goal is to drag the mouse and make the size of that object bigger or smaller. with the following code I can scale it bigger in two dimensions but the other dimension is flat.(I can post a picture if you'd like an example).
function OnMouseDown()
{
myselector = Instantiate(selectorring, slightlyup,Quaternion.identity);
originalmousepoint = camera.main.ScreenToViewportPoint(Input.mousePosition);
}
function OnMouseDrag ()
{
radius = Vector3.Distance(originalmousepoint, camera.main.ScreenToViewportPoint(Input.mousePosition))*100;
myselector.transform.localScale=new Vector3(myselector.transform.localScale.x*radius, transform.localScale.y*radius, transform.localScale.z*radius);
}
I'm stumped because with other code for scaling it doesn't scale as I drag.
Comment
Best Answer
Answer by Molix · May 07, 2010 at 03:56 AM
It looks like in the scale line, you are referencing 2 different transforms: myselector.transform and transform (i.e. this script's transform).
Your answer
Follow this Question
Related Questions
Mirror flip using scale -1 3 Answers
Scale Specific Particle dimensions possible??? 3 Answers
GUI box texture resizes itself 1 Answer
Scale bones of an animated FBX 0 Answers