I have a quad with no visible mesh as a child of a visible 3D cube. The child quad has a Box Collider 2D on it. I’d like this box collider to be able to rotate independently of it’s parent by using z axis rotation. As you can see, when I use the editor to rotate the collider on z-axis (while the game isn’t running, in the editor) there is a strange result. I can’t work out what the problem could be. Please help
Here is the GIF of the behavior: Screen capture - 3b3473df3dc02c860582a7a052c99f13 - Gyazo
Any input would be hugely appreciated!
The best/simplest answer I have found is to create and use additional, otherwise empty objects in your hierarchy. This works to solve not only this issue, but many others you will run into regarding hierarchy’s and transforms. (like this one: Child gameObject won't stick to Parent upon rotation - Questions & Answers - Unity Discussions)
—Empty-root-object(create this new object, and rotate and move THIS object rather than the cube)
-------Cube (now you can scale this cube, without effecting the quad’s transform)
Turns out that wasn’t the issue and I haven’t got a solution. The problem is related to scaling the parent object. This is what it looks like when I scale the parent while the child quad is rotated slightly.
When the parent’s scale is 1,1,1. All of the rotation is perfect, as soon as the object is scaled, this rotation behavior comes back.
Anybody have any ideas?
Old Solution, that is wrong now:
I have managed to find a solution. The child object had no Mesh Renderer. I don’t understand how that could have caused this odd behavior, however it works fine now with the Mesh Renderer on the child object disabled.
Solution I have used:
The problem comes when scaling objects that are rotated. I used the solution in this thread to fix the issue.