How do I wake all physics objects?

Hey guys,

Currently messing with a lot of gravity related stuff in the engine, just wondering where I would look at for waking up all resting physics objects within a scene. The reason being that resting objects do not leave the surface upon a change in gravity because their simulation is sleeping.

I’m not totally up to scratch on my UE4 engine API and I can’t figure out where the list of objects are stored and where the suitable tick function is to place a check in for the gravity change in order to wake everything.

If someone could point me in the right direction or the ideal place to put such a thing that would be great.


#Object or Actor Iterator

You can iterate over all objects of a certain parent class using Object or Actor Iterator

So you could do a search over all Static Mesh Actors and wake all their components, for example

Please note the Iterators are dynamically calculating all current objects or actors in the scene, so if you delete stuff it will not be iterated over any more.

and if you spawn / add stuff it will be found!

#Wiki Tutorial Link

A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine ForumsObject%26_Actor_Iterators,_Optional_Class_Scope_For_Faster_Search

Rama you’re a star, that was exactly what I needed thanks!

By the way, do you happen to know how to find the static mesh components of blueprints. At the minute I can only wake all the static meshes placed directly in the world not those in a blueprint.

Ah disregard that last one I’d used it wrong. I had set up the iterator to find all instance of StaticMeshActors and then woke their components instead of finding all instances of StaticMeshComponent. Cheers!