- Home /
Rotating and scaling children
How can i have 2 cubes which look like this: http://s11.postimage.org/4itcvqpw3/Example.jpg
But where one is a child of the other. When i try, it looks like this: http://s12.postimage.org/h0a4dgq31/Fail.jpg
I want 2 cubes to be arranged like the first picture, but where one is a parent and the other a child.
When i try, the child is squashed in the same direction as the parent. So because the parent is upright, it is squashed vertically, and therefore the child is squashed vertically. I'd rather it was shrunk along its own vertical axis because it is rotated.
Archonn: Have you know difference between local and world coordinate systems?
I understand that in terms of X Y and Z coordinates. A child will be placed relative to its parent. In terms of scale, I thought that a parent might have a X scale of .5. A child might have a local scale x scale of 1, which would sort of mean 100% of its parents x scale so it would be the same size.
But i dont know how to apply that to this.
Answer by Owen-Reynolds · Oct 09, 2012 at 11:41 PM
There's a known "bug" with official Unity cubes as scaled/rotated children. If you import your own cube model, it should be fine. Or just get some free crates from the Unity store and change the textures.
The "bug", last I looked, is that rotated cubes have the rotation baked into the model, to run faster. When it has to go through a complex chain of parent rotating/scaling, that trick throws the order out of whack. [To check this, print the raw verts of a rotated cube -- unlike any other model, they are changed.]
"If you import your own cube model, it should be fine. Or just get some free crates from the Unity store and change the textures."
Please explain. I made 2 cubes and applied a crate material to them, but it still didn't rotate/scale how i wanted.
I'm saying don't use cubes made by the Unity menu: `GameObject->CreateOther->Shapes->Cube.`
Can either borrow a cube-shaped crate model(and not use the material.) Or make a cube in Blender.
That might sound like a pain, but the built-in Unity shapes are placeholders. You're supposed to eventually replace them with real models.
I imported this http://u3d.as/content/yuji-nagata/wood-crate/3nv
But when i parented, rotated and scaled it it was still squashed the wrong way. I'd like you to be more specific as to how to do it.
I'm guessing that particular crate uses the default Unity cube (does the $$anonymous$$esh filter just say Cube, and there's no extra crate model in your Assets?) So just bad luck.
The idea is to get a non-Unity cube. Any crate with an "interesting" texture will have its own model (notice how the one you picked just has the same pattern on each side.) Or model your own cube. Anything that isn't a standard Unity shape model should work.
At first i was making a cube in blender, scaling it to 1 1 .1 to make it flat and saving it as .blend. When i imported it to unity, I was getting a cube which was scaled to 1 1 .1.
I just discovered that if i scale a cube to 1 1 .1 in blender and save it as a .obj, then when i import it in unity i get a flat platform which is scaled 1 1 1. When i parent and rotate it, because no scaling is being done, its not squashed.
Not really an answer to the question i asked, but good enough.
Your answer
Follow this Question
Related Questions
How to Prevent Child Deformation on Rotate? 1 Answer
Object scale/rotation changes when parented to flipped object 0 Answers
How to change child's rotation whithout affecting it's scale? 1 Answer
A way to rotate object 90 degrees when it becomes child of parent? 1 Answer
change/scale child rectTransform with Parent (with video) 0 Answers