Some questions about optimization of 500+ physics bodies.

I have space game with a lot of asteroids (500), it is for mobile.

Recently i found out that spawning 500 asteroids that are not “awake” (ie. do not move at spawn at all) is fine with even android devices.
But then i tried to add slow random spin to them (added random angular impulse at begin play). And fps dropped dramatically.
It was even worse when they were clustered and got some collisions, this was just beyond bad (could not write stat fps).

For Spinning asteroids fps was 12, while for inactive i got 60+. I do not do any calculations for them on event tick, i plan instead to use dispatchers and events that i tell asteroids to hook when pawn is nearbly.

So my questions is if i add damping to asteroids and they stop all movement after few seconds do they stay active or go back into sleep mode. Because some persistent player could theoretically wake them all in game.
Or there is a way to put them into inactive mode from blueprints?

Ok folks. i did some experiments and it looks like when something stops moving/rotating it gets into physics sleep mode again. I think it happens right after its linear and angular movement get to zero, no delays.

That would make sense … If there is no movement they may as well be ‘asleep’ … You should be able to force them asleep by manually setting the angular and linear velocity to zero. There are BP nodes for that … Might cause physics weirdness of course …

If you manually set any velocity or rotation/location to physics body, it sometimes has quite big effects.

For eg. If you move object from tick to tick and there is some other physic body moving and colliding with it at same tick. It may be accelerated to huge speeds, because physics engine “thinks” that other body is moving very fast (one you updated location/rotation from blueprints). So mixing scripted locations with physics emulation is bad idea.