Search Unity

Physics performance (Ragdoll example)

Discussion in 'Physics' started by Kjelle69, May 7, 2020.

  1. Kjelle69

    Kjelle69

    Joined:
    Nov 9, 2016
    Posts:
    53
    I am experimenting with ragdolls and vehicles and are experiencing performance issues.
    These simple ragdolls in the flatbed of EDY's VPP-pickup truck are struggling to hang on to the pace of the car.
    They consisting of only 11 colliders each and the truck have five.
    All objects have continuous collision detection activated.

    Any idéas of how to optimize settings to obtain a smoother simulation?

     
  2. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    I guess the first things to try are increasing solver iterations in Physics and decreasing fixed time step in Time settings.
    Do you do all movements in FixedUpdate? Do you use forces to move vehicle?
     
    Kjelle69 likes this.
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    For a start your ragdoll rigidbodies should have interpolation on (fix jerking). Secondly you should add the car velocity and angularVelocity difference* to the ragdoll rigidbodies every frame, with a slight multiplier say 0.8, then tweak.

    Why?

    Physics engine will be too slow, and require too many iterations if you try to brute force this. It's one of the situations where you need to give things a helping hand (or velocity) to maintain stability. Unless you have a render farm.


    *the differences in velocities between car and rigidbodies riding on it, are better because these forces are way less invasive and more integrated. The reason we use a multiplier is so it still feels natural sloshing about in the back but not so little to make things slide off and fall out.

    Done right you can just use discrete, low fixed update rate, and enjoy a well behaved ragdoll physics sim. But like any blockbuster game you play, expect there to have been a lot of correctional or helper forces to compensate for the lack of processing available.
     
    Kjelle69 likes this.
  4. Kjelle69

    Kjelle69

    Joined:
    Nov 9, 2016
    Posts:
    53
    Thanks @hippocoder , Rigid Body Interpolation = on totally solved my issue :)

    It was enough to apply this on the Root . (Hips) All the other limbs still have interpolation off.

     
    zacharyyates and hippocoder like this.