Friday, January 3, 2020

unity - cube collider losing shape upon rotation


I'm not sure what's going on here. I have a cube which I have turned into a rectangle; it's a child of a plane which is the "ground" so that they share rotation (this is a pinball table).


To create these cubes, I just used the create => 3d shape => cube/plane option. No packages are used.



The issue is when I rotate the rectangle, the collider visibly becomes wrong.


This is before rotation:


enter image description here


This is after rotating on the y axis:


enter image description here


The collider does seem to rotate, but not at the correct amount. Can anyone shed some light as to what's going on here?


Here's the inspector and hierarchy:


enter image description here


enter image description here


I also tried making the plane a cube, it didn't change anything.




Answer



It seems like the issue is that I cannot change the rotation on a child object when applying a scale to the parent.


In other words, when inheriting scale, don't use rotation.


I'm not exactly sure why this is the case but here's my takeaway. Apply the scale to the object which is being rotated, not to its parent.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...