Search code examples
unity-game-engine

Only some sections of my Unity-simulated robot aren't bouncy


My robots, imported using com.unity.robotics.urdf-importer, behave as if a buoy on water instead of being on solid ground. Only the legs/extremities float, and the central sections behave as I want them to

I use ArticulationBody for the elements, and their settings look like

this

but for reliability the relevant ones are recreated here (values marked * have undergone several changes in hope of fixing):

  • Use Gravity: Yes
  • Linear Damping: 0*
  • Angular Damping: 10*
  • Joint Friction: 10*
  • Collision Detection: Continuous Spectulative*
  • Articulation Joint Type: Revolute
  • Motion: Limited
  • XDrive:
    • Lower Limit: -60
    • Upper Limit: 60
    • Stiffness: 100000*
    • Damping: 100Æ
    • Force Limit: 3.402824e+38*

See this this youtube upload for a visual demonstration of the issue

I have tried adding new box colliders to all elements, it didn't do anything. Applying a custom physic material can change the friction and bounciness of the central section only, but the extremities continue to ignore anything I do to them


Solution

  • The solution was two-fold:

    In order to fix the bouncing I had to go to Project Settings > Physics > Default Solver Iterations and increase it. This increased the granularity of the simulation and stopped the elements from bouncing. Still uncertain why the middle sections did not bounce, but it is moot now

    In order to fix the subsequent sliding I had to go to Project Settings > Physics > Friction Type and change it to Two Directional Friction Type. I don't know why this worked, but I assume that - similarly to the prior fix - it increased accuracy by paying performance



    I had used a box collider instead of a mesh collider. Switching to a mesh collider as the ground (by spawning a simple plane instead of a simple box) all issues evaporated