Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rescaling of objects

Discussion in 'Physics' started by StarvingIndieDeveloper, Jan 26, 2016.

  1. StarvingIndieDeveloper

    StarvingIndieDeveloper

    Joined:
    Aug 21, 2015
    Posts:
    274
    A search of the forums oddly didn't find anything about this problem. Rescaling objects wreaks havoc on physics, even if the original dimensions are kept and the collider fits the rescaled object. Is there any way to work around this problem, rather than creating new meshes at the desired scale?
     
    Last edited: Jan 26, 2016
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Re-scale the meshes in the import settings, or you can make the odd scaled gameobjects children of a non-scaled gameobject (no guarantee this will actually work)

    Known fact that odd scaled gameobjects mess with physics
     
  3. StarvingIndieDeveloper

    StarvingIndieDeveloper

    Joined:
    Aug 21, 2015
    Posts:
    274

    Thank you. Changing the scale in the import settings didn't help, nor did making my own custom mesh - a test with a simple brick to create a brick wall still produces a wall that topples over even with no force applied; but that doesn't happen if I use the brick included in the Standard Assets demos that come with Unity5. I need a smaller brick than that one, but rescaling the Unity brick and making my own both produce an unstable wall. It seems to have something to do with the center of mass setting, but I've adjusted that setting according to the same pattern as in the Unity brick (Size = actual size in world units, hence 0.6, 0.3, 0.3; Center = actual center, hence 0 for x and z and half Size.Y for y).
     
  4. StarvingIndieDeveloper

    StarvingIndieDeveloper

    Joined:
    Aug 21, 2015
    Posts:
    274
    I've figured out part (or possibly) all of the problem, but I don't know how to solve it. When I have blocks stacked tall enough in a wall, the ones on the bottom sink slightly into the ground (which is a stationary object with a collider but no rigidbody, so it doesn't move). The blocks tilt slightly as they sink, causing the wall to tip over. If I make four walls into a tower, the bottom of the corners sink, causing the blocks above to bulge outwards and then spill downwards. I can reduce the problem by making the walls shorter, but there's still some buckling. Oddly, reducing the weight of the blocks doesn't seem to help, although I would think it was the weight which causes it to sink. Changing the ground's collider's physical material to metal doesn't help. Placing heavy buttresses on one corner slows the rate of collapse for that corner, but only to a point.
    Anyone know how I can prevent this problem? It makes it impossible to make stable buildings.
     
  5. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    not 100% sure its something you can do with Unity. You possibly have to manage the blocks themselves, toggling between kinematic/not when they are stable/unstable.

    you could try messing with the penetration/pushout forces (forget the correct name - but its something along those lines under project->physics)
     
  6. StarvingIndieDeveloper

    StarvingIndieDeveloper

    Joined:
    Aug 21, 2015
    Posts:
    274
    The closest setting would seem to be "Default Contact Offset" ?
    Have you ever seen a case in which a simple brick wall collapses if built high enough, or is it something I'm doing wrong? Even Unity's default brick causes a collapse (albeit not as bad), so I assume it's due to small rounding errors adding up.
     
  7. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
  8. StarvingIndieDeveloper

    StarvingIndieDeveloper

    Joined:
    Aug 21, 2015
    Posts:
    274
  9. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    awesome.