How to tell if a physics mesh is asleep?

How can I tell if a physics mesh is asleep? “Is Simulating Physics” returns true even of the mesh component is put to sleep. Checking velocity or position over several frames is a hacky and unreliable solution. If a proper check can be done in a new C++ class in the project then I’d be happy to add it.

Hi ZoltanE,

There is currently not a check exposed to blueprints to see if a physics object is sleeping or not. I have entered feature request JIRA UE-33640 and our developers will be investigating this further.

You should have full access to make that check in code. If you write something that exposes it or create a code check, please feel free to post it here.

Cheers,

TJ

that’d be good to have as a blueprint event too.

I have no idea how to implement this in C++ so I’d appreciate if someone posted a source for it.

In C++ code if you have an physics object / mesh whose class type is derived from UPrimitiveComponent (which it should be) you can call its IsAnyRigidBodyAwake() method. That’ll tell you the opposite of what you want, whether it’s awake.

For a temporary workaround you can add this line above the declaration of IsAnyRigidBodyAwake() in Engine\Source\Runtime\Engine\Classes\Components\PrimitiveComponent.h (around line 1694) and compile the editor to expose the method in Blueprints:

UFUNCTION(BlueprintCallable, Category = “Physics”, meta = (Keywords = “physics asleep sleeping awake simulating”))

This should be available in 4.14.