Prevent rigid body from falling asleep

Hey everyone,
is there a way to prevent rigid bodies from falling asleep? I tried setting the sleep family to “custom” and the threshold to 0, but it didn’t seem to have any effect. Waking the body every tick kind of works, but it causes stuttering (probably because the physics are calculated independently of the main tick) and also it seems more like a workaround.

4 Likes

Yeah, this seems extremely bugged at the moment. The only other work-around I figured out so far has been to enable “Generate Wake Events”, which — despite the name — is required to generate sleep events. Then in onComponentSleep call WakeRigidbody.

In my project this thing is physics constrained to a rigidbody which is a child of a motion controller and should wake up as soon as the controller moves, but it doesn’t, so I feel like this is a Chaos bug (maybe it should be named after Hypnos, rather than Kháos). It even manages to sleep through the sensor noise and subtle hand movements of a human trying to keep their hands still, so it seems way too sensitive.

I saw another thread request information about how to re-enable PhysX in Unreal 5, which would probably best until Chaos is production ready, but unfortunately it didn’t have any replies either.

4 Likes

(I have submitted bug report # 00425529 about this)

2 Likes

So… that sleep threshold… it doesn’t do anything. And I’m not talking metaphorically.

Unless I’m very mistaken, it’s CustomSleepThresholdMultiplier in code. It gets used in GetSleepThresholdMultiplier(). InitDynamicProperties_AssumesLocked() calls it for its calculation of SleepEnergyThresh, in a way that will always make it 0. But that doesn’t matter, because the code it’s then passed to looks like this:

void FChaosEngineInterface::SetSleepEnergyThreshold_AssumesLocked(const FPhysicsActorHandle& InActorReference,float InEnergyThreshold)
{
}

So… I don’t understand the sleep system yet, but I do know that they either forgot to implement this, or forgot to remove these settings. Combined with the lack of wake up through constraints, I wouldn’t be surprised if the whole sleep system simply isn’t done yet.

1 Like

So while you guys want to stop a body from sleeping I have the opposite problem that my rigid body ragdoll on metahumans or even the default manniquen is not going to sleep. They never really stop moving even if it is just a tiny bit of movement but it various. I tested it with the manniquen even on a template just to make sure it isn’t something wrong, then I went back to a 4.27/2.6 and saw that the problem doesn’t exist there.

1 Like

Thank you, I’m experiencing similar issues, let us know if they accept the report

1 Like

Hey, similar issues here as well, I am doing some objects that player can kick around. They start with Start Awake turnd off. I am waking them on impact, but then they never go sleep.

If I leave Start Awake on true, then they are awake all the time.

A temporary solution i am using for this is calling Wake_Rigid_Body on the static mesh in the tick, with a time interval of around 0.2 seconds.

Waking the rigid body on the OnComponentSleep is a workaround with downsides (actual velocity is lost).

However I think I found a fix and the reason why the sleep threshold is ignored: it’s using properties from the physics material. Set the “sleep linear velocity threshold” and the “sleep angular velocity” both to 0, and the “sleep counter threshold” to max value. I didn’t get any sleep events anymore.

14 Likes

THANK YOU. IT SOLVED

This worked for me, thanks!

creating a new physics material with the properties set with your values and assigning it to the “Simple Collision Physical Material” property of my shape solved it for me, thank you

2 Likes

Creating and assigning a new Physics Material with the correct property values worked for me as well, thanks.

1 Like

Just confirming the issue is still here and your solution still works.

1 Like

Thank you everyone, Making a Physics Override Material, with its sleep values(Thresholds) set to 0, and applying it to any mesh, prevents it from sleeping. Cheers https://twitter.com/GameDevMicah/status/1753909039757664421