Search Unity

[Hololens] Physics of small objects

Discussion in 'Physics' started by Saidbet, Aug 10, 2017.

  1. Saidbet

    Saidbet

    Joined:
    Feb 23, 2016
    Posts:
    9
    Hi, I'm making a sandbox, physics based game on Hololens.
    My problem is the following:

    In Unity, 1 unit is equal to 1 meter IRL for the Hololens.
    In my game, the player has the ability to make vehicle with multiple blocks, and thus, the blocks need to be small.
    Currently, my blocks have a scale of 0.05, which is 5 centimeters IRL, and that's the size I want for the blocks because I want the player to be able to play around with his vehicle on a table (for example).

    Capture.PNG

    The problem is when the scale is too small, the physics engine's behavior is weird, whenever I add wheelColliders, the object is shaking and starts blowing (blocks are attached with fixed joints). Sometimes it even falls through the ground

    I know the problem is due to the scale because I experimented a lot, and if I make the same object with bigger blocks, I don't have the issue.

    Does someone have a solution to my problem, without needing to scale up everything ? Thank you.
     
  2. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    82
    Yeah, I had a similar problem in a project that allows you to pilot/drive several model-scale vehicles.

    After beating my head against the wall in frustration for several weeks I gave-up and wrote my own code to handle most of their physical simulation.

    For things like cars, I used frictionless sphere colliders on each wheel and a rigidibody on the body. I then directly set rigidbody.velocty for forward movement and rigidbody.AddRelativeTorque() for steering. There's naturally quite a bit more involved, but that's the core idea. (I rotated each wheel according to velocity and steering, decreased turning radius with speed, etc.) Since my vehicles were "toys", the simplified physics was "good enough" for my purposes. (Look around for old Unity vehicle controller code that handled this stuff before things like the wheelCollider were invented.)

    One other option is increasing the scale of everything in your project by a factor of 10 or 100. (This introduces a lot of issues you have to handle, but might work for your needs.)

    Hopefully this answer saves you a little time. If there's a better solution I'd love to know it.
     
  3. Jeeses

    Jeeses

    Joined:
    Aug 30, 2013
    Posts:
    3
  4. Saidbet

    Saidbet

    Joined:
    Feb 23, 2016
    Posts:
    9