Search Unity

SimulationCallbacks.Phase.PostSolveJacobians - are you using it?

Discussion in 'Physics for ECS' started by petarmHavok, Nov 13, 2020.

  1. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    Hello everyone!

    I'd like to ask a question that will help us make a decision of what to do with this callback. The question is - are you using it? If so, what are you using it for?

    We are thinking of removing it all together for 2 reasons:
    1. Havok Physics triggers this callback only after the integration of bodies, so it's already too late to do anything.
    2. The core use case for it with Unity Physics was to be able to zero-out velocities of settled bodies so that stable stacking can be achieved. However, with the recent solver stabilization feature we shipped, we see no other uses for this.

    If you have any thoughts or ideas, we'd like to hear them!

    Thanks,
    Petar
     
    Lukas_Kastern likes this.
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
  3. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    As far as I can tell, modifications for soft constraints come before the solve, not after. We would still keep the PostCreateContactJacobians callback for this use case.
     
  4. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    128
    I tinkered with it to stabilize stacks and to clip velocities according to my needs. For stacking it seems to be the only way to apply clamping selectively, allowing for things like ice cubes. General solver stabilization is faster for sure, but it's a blanket approach.
     
  5. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    Would a workaround of scheduling something after step and undoing integration (plus zeroing velocities) be ok for you in case we remove this?
     
  6. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    128
    Sure, I mean I've just experimented a bit with that callback, nothing production-focused.
     
    steveeHavok and petarmHavok like this.