- Home /
Many 2D rigidbodies optimization
I've got many - thousands - rigidbodies. Const velocity and direction(ofc different on different rigidbodies), trigger circle colliders, no actual collisions. Is there option to optimize it more somehow? Changed fixed timestep, but it's not enough. If not without ECS, how to migrate to ECS? I cannot find and substantial data about physics.
Answer by YetAnotherKen · Sep 09, 2019 at 07:31 PM
The Unity engine uses PhysX to simulate physics. One option I see is to use Kinematic animation so that you don't incur the PhysX overhead for thousands of RigidBody interactions. You would still have to do a little of your own calculations (vector mathematics) to get correct rebounds, etc. Other methods used are like simplifying the collider mesh to a sphere or cube. Or, reducing the view distance to limit how many of these objects are in view of the player.
As mentioned, there is no actual collision, only trigger, so no rebounds. Also circle colliders only - I believe there is no simpler collider here. And 2D. But thanks, I'll try kinematic animation, never considered it.
Your answer
Follow this Question
Related Questions
Rigidbody2D.velocity out of controll 3 Answers
ForceMode2D.Force not working in fixed update 1 Answer
2D Bounce gains energy each time 1 Answer
Get information on ignored collision 1 Answer