- Home /
Cube changes size when adding HingeJoint
I'm scripting a house for fun and to learn Unity better. My current obstacle seems to be the scale of the door, to which I'm adding a HingeJoint.
The door is a gameobject in a hierarchy of other objects, like so (slightly simplified):
House:
- floor1
- wallpiece
- door
- wallpiece
- wallpiece
- floor2
- wallpiece
- window
- wallpiece
- wallpiece
- floor3-- etc
Everything is set using localscales and localpositions, and as a result displays perfectly positioned and scaled where I want it.
The problem: Adding a HingeJoint to the door makes the cube (the door) noticeably bigger. It no longer fits in its doorhole.
Looking at the localscale values of the door, they are the exact same before and after adding the hingejoint. The object itself however is visibly bigger.
Thanks for any insight into what is causing this, and thanks for a great tool like Unity 3d!
You're supposed to post your answer as once of the answers and then mark is as correct, ins$$anonymous$$d of adding "[solved]" to the topic. Welcome to Unity Answers!
cut out from question
"Solution: Human error, the door had the wrong size all along. Adding a hingeJoing just revealed the problem."
@johnfrian: You have two ways to deal with your question:
If you found the solution to your own question, post an answer and accept it.
If you think the question isn't relevant to anyone else (that would have been a reason to not post it here in the first place), just delete it.
Further more, if you plan to ask more questions in the future, please read the FAQs first, so you know what questions can be asked here and how they should be phrased.
Answer by johnfrian · Feb 14, 2012 at 11:12 PM
This was human error, the door had the wrong size all along. Adding a hingeJoint just revealed the problem.
Answer by Bunny83 · Jan 31, 2012 at 02:01 PM
The point of an object hierarchy is that all childs inherit the parent position / rotation and scale. If you scale up the parent, all childs will be scaled as well.
Every GameObject represents another localspace in which other gameobjects can "live".