All Rigidbodies waking up when hit one

We have a bunch of Blocks (10 * 10), stacked on each other, all touching, and if one of them gets hit, it wakes up all of the 100 Rigidbodies
Is there a way to not have all of them wake up?
Does anyone have any optimizations for this scenario?

Thanks

What outcome do you want to achieve? Naturally all of them will react because they’re colliding with the block you apply force to.

You can edit some of the behaviour of the physics by applying a physics material to your objects and setting the friction higher.

All the Blocks waking up, and then some movement of a few of them, causes a big performance hit for the system we are working on, so to not have all of them wake up might help the performance

If changing the physics material and the mass doesn’t help then you would probably have to solve it yourself by deactivating the rigidbody on those blocks you don’t want to move.

If you trigger a chain reaction with many objects then the physics engine will have to work a lot. I think it’s the expected behaviour.

Not sure if this is 2D or 3D but for 2D, bodies are connected together via “contact islands” i.e. contacts between bodies. Indeed, they are solved as islands. This is so that constructions like stacks of colliders work correctly.

Whilst Wake/Sleep is an internal performance improvement by ignoring sleeping bodies, it’s not supposed to be used to cause a body to sleep when it’s not in a stable/resting position as a number of things can cause a body to wake, at which point it’ll start moving.

Another reason bodies are woken are when any of their collider AABB overlap other collider AABB on other bodies. Also if you explicitly wake a body, it will cause other bodies in the same contact island to wake so that the whole island can be solved.

I am not sure what you are doing but if this is indeed 2D then you can use Rigidbody2D.Simulated to temporarily take the body, its colliders and joints out of the simulation.

It is in 3D

Someone was saying we might be able to change the Simulate settings in 5.6
First I will try keeping all the Blocks from Sleeping, then selectively choosing which Blocks will use the Physics based on which ones are hit

I’m a little confused. If these blocks are resting on each other then they all need to be aware for collisions to work correctly. If they are not resting on each other but are just falling into some kind of regular grid then you don’t need physics at all, especially collisions. It might be wise to provide some more context if you want some workarounds or maybe a better approach to what you’re doing.

We have decided to keep the Blocks Kinematic until they are hit, then trigger the ones above to turn off Kinematic and turn on Gravity, so that many Objects are not active at once, seems to help a bit for performance
There is a chance to take out Blocks that are lower on the Stack and have a large number of Blocks fall over

Sorry if I have not given the best Context for this

1 Like

Not a problem, as long as you get the results you want!