Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Feedback How to make the dynamic accuracy of physics dependent on the speed of the object?

Discussion in 'Editor & General Support' started by Goof1, Nov 2, 2022.

  1. Goof1

    Goof1

    Joined:
    Jan 22, 2022
    Posts:
    4
    Hello, I would like to know how to implement a different number of physics calls for different objects. This is necessary to optimize the physics of a huge number of objects. When an object is stationary, then its physics is calculated, say, 5 times per second, if it moves at a speed of 1 meter per second, then 5 + 5 = 10 times physics per second, if 2 meters per second , then + 10 and so on, and so that one object's physics could be calculated 100 times per second and the other 5. If anyone has any suggestions on how to implement this in any of the game engines, then please write.
     
  2. TzuriTeshuba

    TzuriTeshuba

    Joined:
    Aug 6, 2019
    Posts:
    186
    what do you mean by a physics call? you can disable and reenable the colliders if that is what you are looking for, which will prevent trigger and collision detection. You could also set myObjectsRigidBody.isKinematic to true, but physics forces would stop acting on them (in this case you may want a script that manages the objects to maintain their inertia while "un-physicsed" and repopulate the inertia when "re-physicsed"). Again though, not sure what aspect of physics you're looking to limit, and im skeptical of how much these solutions would actually optimize at the bottom line.
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,960
    Unity already implements this optimization for you with the "sleeping" feature.
     
  4. Goof1

    Goof1

    Joined:
    Jan 22, 2022
    Posts:
    4
    fixed update updates physics by rearranging all objects simultaneously with a frequency of 0.02 by default, but I need to make sure that each physical object has its own physics update depending on its speed at the moment.