Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Disabling collider and setting RB to kinematic doesn't improve performance? (PhysicFixedUpdate)

Discussion in 'Physics' started by HSForge, Sep 2, 2018.

  1. HSForge


    May 22, 2017
    In my game I have plenty of destructible objects (rocks, etc). Each object has a mesh collider, kinematic rigidbody, and simple script to store object's data (health, etc.). I have implemented an optimization mechanism by disabling distant object's collider, and only enable nearby ones. However, it doesn't improve the performance any tiny bit. In order to make any difference I have to disable the whole game object completely (which I hope it is not the only solution).

    It's not like I haven't searched/googled this problem yet, I have. Somewhere I read that setting rigidbody to kinematic will make the physic to ignore it completely. I haven't confirmed this yet. But based on this problem that statement might be not true (?).

    Here is a pic showing before and after I disabled all destructible objects:

    Before (objects are enabled):

    After (objects are disabled):

    So is there any other way to disable rigidbody? I mean other than setting it to kinematic since it doesn't seem to work. And preferably without having to remove the rigidbody component at all.

    I've had this problem for a long time actually, but only managed to make a thread about it now. I'd highly appreciate any help. Thanks in advance!
  2. StickyHoneybuns


    Jan 16, 2018
    The reason you aren't seeing any performance increase on just disabling some box colliders is because they aren't that performance heavy anyway, especially compared to everthing else. Why are you doing this anyway? Do you have performance issues? I assume all your collisions happen in fixedupdate which would make sense. Not having to calculate a large amount of collisions can save some performance.

    Setting a rigidbody to isKinematic will make it ignore all outside forces and you will have to control it by script.

    So what exactly is your problem?