Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Physics in Unity 2022.2 -- collecting feedback.

Discussion in 'Physics Previews' started by yant, Feb 22, 2023.

  1. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    573
    Hello!

    We are the team behind the PhysX integration in Unity and we'd love to hear any feedback on the physics features and changes in Unity 2022.2 (and earlier).

    Thank you.

    Anthony
     
    Lionious likes this.
  2. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    211
    One issue that still constantly plagues The Last Clockwinder is that collision response does not seem to be locally deterministic. Essentially if there is a stream of rigidbodies all moving and bouncing against the same objects, they won't always bounce in the same trajectory.

    Or another way to put it: we need determinism of collision response, even if other bodies are added / removed from other parts of the world.

    I know this isn't a guarantee in PhysX. It's only deterministic if you replay inputs from the start, but it'd be nice to find a way to work around this! The various settings in the physics settings don't help.

    I have to assume the issue stems from the binning process / ordering of the collision responses.
     
    Acetylan likes this.
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,361
    Improved Patch Friction

    To me, the most significant addition to Physics in Unity in the recent versions was the improved patch friction in Unity 2021. I upgraded my main projects from Unity 2018-2019 straight to Unity 2021 because of this feature alone. This option should be enabled in new projects by default.

    Frictions and collisions used to work nice in Unity 3 and Unity 4, but become broken in Unity 5. We had to deal with non-realistic and rather unpredictable frictions and collisions all this time because the reactions strongly depended on the number of contact points in the collision (!). It was essentially trial & error from Unity 5 to Unity 2020, far away from any expected physically realistic behavior. So I'm very happy that you guys finally could improve this part in Unity 2021.

    Contact Modification API

    Another great addition was the Contact Modification API. I haven't had a chance to test it extensively yet, but as for the documentation I think it could allow to simulate some sort of elastic collisions. This would have a direct application to car collisions (as they're never rigid collisions, there's always some deformation absorbing the collision energy) and hopefully to simulate volumetric 3D wheels at very low speeds.

    Wheel Sweeps

    Speaking of volumetric 3D wheels, I'd really appreciate if you give some love to the WheelCollider and expose the Wheel Sweeps feature from PhysX Vehicles. There's a significant demand for this feature today.

    WheelCollider.sprungMass

    In terms of vehicle physics, I'm very grateful to you because of exposing WheelCollider.sprungMass for read/write in Unity 2019. This allowed me to keep using the WheelCollider for suspension in my vehicle simulation packages, with very realistic and stable behavior.

    Let's face it, the "sprung mass model" in PhysX is essentially a broken design because it assumes the car is under a constant vertical acceleration of 1G. That only happens when the car is at rest or cruising at constant speed on a flat plane. The calculations for suspension and friction in PhysX explicitly include the term 1G, which it's nonsense to anyone with even a minimal knowledge of vehicle simulation. Proof of this is that if we remove the gravity from the scene and apply an equivalent downforce, a vehicle based in the WheelColliders just slips around indefinitely on a flat plane: no tire friction is generated at all.

    In my case, I don't use WheelCollider friction but the suspension only. Being able to explicitly write the sprung mass value allowed to remove the 1G term from the equation in PhysX. Now the suspension totally behaves as a realistic suspension no matter the actual vertical acceleration applied to the wheel. I use this solution extensively, and it has been validated on high end engineering projects for the motorsport industry.

    Unity 2022

    As for Unity 2022, new features look interesting but I'll try them when it's released out of Tech, so I can't tell anything yet.

    Integration of PhysX 5

    As for the future, I'm sure that most of us expect the integration of PhysX 5. Current PhysX is so severely optimized for performance that even the simulation of rigidbodies with non-uniform inertia (almost anything not being a primitive) is non-realistic and plainly faked. This is confirmed by the PhysX devs themselves. PhysX 5 brings back a realistic rigidbody simulation.
     
    Last edited: Apr 17, 2023
    Lionious, schaefsky, Acetylan and 6 others like this.
  4. Lionious

    Lionious

    Joined:
    Apr 19, 2013
    Posts:
    47
    when do we expect the integration of PhysX 5