Download

Physics switch-off threshold in UE4 during runtime

I am working on self-balancing algorithms and have a dummy with a base (the ‘foot’), a body, a head and two arms (all just primitive capsules) that are linked by limited angular contraints.
Everything but the base has physics switched on.
I start the simulation, the body tilts and the arms start moving, by applying motors to the constraints, trying to get my dummy back upright.

When my dummy finds a position that is stable or a tiny repetitive overall motion happens (unfinished balance algorithm), then physics switch off.
I am pretty sure it is because the engine notices that the physics solution is repetive or even has zero change, and therefore puts everything sleep.
I also have setup gamepad input to intervene in the balancing algorithm and set the angular drive via gamepad if I want (move the arms). After physis freezes, manual input is also disabled, ie. the angular drive is disabled overall.

Is there a way in config files or similar to turn this off? Some kind of threshold? I would like constantly run physics.

(I noticed this behaviour before, when I stacked 1600 cubes to a wall, and built a little tank that can shoot canon balls into it, all fully physics enabled and without animation/scripting. When I started here, framerate drops because of the mass physics, but after a while of doing nothing, frame rate goes up again, because the engine seems to notice that the wall and its physics solution is stable. The moment I shoot a canon ball into the wall, stuff seems to awake and framerate goes down again.)

Hi dev100000,

You could try setting the SleepFamily property in the body configuration for your objects to SF_Sensitive. This reduces the energy threshold used to decide when to put a body to sleep.

Hopefully that helps :slight_smile:

Benn.

Thank you! It helped, there is no freezing anymore.