Search Unity

Profiler says static collider move is expensive. (But the object is not set to active...)

Discussion in 'Physics' started by screenname_taken, Oct 30, 2015.

  1. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    663
    What the title says. The profiler says that it's moving an expensive static object but when i check that object, it's not set as static. It doesn't have a rigidbody attacked, but as far as i remember, it stopped beeing expensive since U5 because of the newer physX used. Or at least that's what i got from the physics presentation back then.
    Is it just a warning that didn't get removed, or does is it really expensive?
     
  2. MortenSkaaning

    MortenSkaaning

    Joined:
    Jan 16, 2015
    Posts:
    120
    yes, we should relax the warning :)
     
  3. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    MortenSkaanin, I'm aware you fixed that issue in Unity 5 but can you confirm if creating rather than moving a static collider at runtime is still slow?
     
  4. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    396
    Yes, and Morten, please say what is the cheapest method to move my colliders, I don't need them to detect collisions or overlap, just repositioning complex mesh collider very often. And I understand that moving static colliders isn't expensive anymore, but is that mean it is equally expensive to move static collider and kinematic rigidbody with the same collider?
     
  5. MortenSkaaning

    MortenSkaaning

    Joined:
    Jan 16, 2015
    Posts:
    120
    Moving static Colliders should now be as fast as moving Rigidbodies. Remember that if you teleport them around constantly you will pay a cost proportional to the length you move them. It will not be high, but it might be a surprise if you though it was entirely free.

    Kier had a good reply regarding what we updated on the static Colliders:
    "Hi guys

    Just a little follow-up on the debate over this modification to static actors. In fact, the static actors are still static actors (PxRigidStatic) and both memory footprint and simulation performance will not be affected by this change. What has changed is the use of a dynamic pruner instead of a static pruner for the static scene in the scene queries instead of using a static pruner.

    Whenever any static actor in the SQ scene is updated, inserted or removed, the static pruner is rebuilt from scratch. This can be very expensive if you either move a static actor (clearly not recommended) or simply have a streamed environment when your static scene consists of lots of shapes. The dynamic pruner, on the other hand, is incrementally updated so inserting, removing or teleporting actors causes less of a spike because the cost is spread over several frames.

    You still have 2 separate scene query pruners – one for the static actors and one for the dynamic actors – so if you don’t insert/remove or update any of your static actors, it is not expected that you will observe any performance regressions. It is just that they are both now using the same type of pruner instead of using 2 different pruner types. The performance of scene queries in general in PhysX 3.3 are significantly faster than PhysX 2.8.3 so you should see nothing but performance gains when you upgrade.

    I hope this helps to clear this up

    Many thanks

    Kier (NVIDIA PhysX engineer, in case you were wondering)"
     
  6. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    396
    Thanks, that answers my question 100%.