Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Physics: Update PhysX to 3.3.3

Discussion in '5.5 Beta' started by MrEsquire, Sep 27, 2016.

  1. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Has it be included already? or in a beta to come?
     
  2. Alex-Lian

    Alex-Lian

    Guest

    Already in. It's listed under Improvements in the release notes.
     
    John3D and MrEsquire like this.
  3. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    Can we get articulations exposed in Unity 5.5 at some point?
     
    electric_jesus likes this.
  4. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    yes please add articulations..
     
  5. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Will we ever get PhysX Raycast Batched queries support?
     
  6. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    It's unlikely articulations would be featured in 5.5, but I think there's no way around of exposing that stuff eventually. We've experimented with articulations last hackweek so there is a branch with some preliminary exposure but it's not publicly available yet. I think the video should be available on the web.
     
  7. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Yes, there are discussions going on about introducing something that would allow batching & running all physics queries multithreaded.
     
    elias_t likes this.
  8. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Hey,
    I have a question regarding the PhysX behaviour with overlapping bodies. I just tested 5.5.0b5 with a scene that instantiates cubes with kinematic RigidBodies and moves & rotates them on Update by setting RigidBody.position and RigidBody.rotation. All collisions are disabled in the physics settings and the cubes have BoxColliders set to trigger.

    If I spawn 500 cubes in a 25 unit radius with colliders on, all is fine:

    1.jpg

    500 cubes in a 1 unit radius with colliders enabled results in horrible performance:

    2.jpg

    500 cubes in a 1 unit radius with colliders disabled is better but still bad:

    3.jpg

    So what's going on there internally? Obviously overlapping bodies (and especially colliders) cause a performance degradation, even if I they are kinematic and not colliding with anything, but is that something that can be fixed?

    Imagine something like Crimsonland ( https://i.ytimg.com/vi/ogVvf8-pXDU/maxresdefault.jpg ) where I want to have a thousand enemies on the screen at once and I only want to use the Physics engine to raycast against hitboxes. How do I optimize for this case or am I better off rolling a custom solution with spatial hashing and collider checks? I'd just assume that PhysX would already do it more efficiently than I can with C# code, but I can't figure out the best way to do it.
     
    Last edited: Oct 1, 2016
    mh114 likes this.
  9. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    I'm just guessing here that internally the physics engine resolves 500*500 collisions before checking the layers. So if that's the case, my question is would it be possible to have a raycast only collider, that is only ever checked against raycasts and completely ignored otherwise?
     
  10. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    Your cubes have two colliders. Is it intended?
     
  11. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Whoops, it sure wasn't! So basically the so called "colliders disabled" is the cubes overlapping with one collider, which is still much slower than the cubes being apart or colliders disabled. Trigger or not doesn't matter and neither does having all layer collisions disabled. It's still something that I'm interested in optimizing.
     
    Last edited: Oct 4, 2016
  12. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Maybe @yant could provide some insight on what's happening internally and why and whether it would be possible to have some sort of a "raycast only collider" that would skip whatever is happening?
     
  13. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Well, in case anyone was wondering, the best solution is to not use a Rigidbody at all and move the colliders via Transform.position, in case you just want to use colliders for raycasting and don't need any collisions by the physics engine.