28-02-2023, 03:25 PM
(This post was last modified: 28-02-2023, 03:31 PM by josemendez.)
(28-02-2023, 03:14 PM)ImpossibleRob Wrote: The 500ms result from the CPU solver of obi, since I still cannot activate burst (see other thread). That might be the reason for this order of magnitude. My game is a physics game where basically anything can happen in a non-localized area, e.g. a cannon shoots a ball to the other side, hitting something there, causing a rope to move etc. Is there a way to tell the solver or have the solver only consider colliders in the ropes area of influence?
The solver already only considers colliders close to a rope during simulation. However, Unity must update the position of all colliders that have a ObiCollider component and this must happen in the main thread, this is what the cost comes from.
Simplest solution for this is the one I suggested before: group them by spatial proximity (using a regular grid, for example) and only add the ObiCollider component to those collider in zones that intersect the solver's bounds.
This is the same approach you'd use in any game where thousands of objects must undergo some sort of update. For instance if your game took place in a castle full of rooms, you would not update every object in all rooms all the time: you would only update those in the room you're in, or a few rooms adjacent to it.