Simulate physics and rotating an object below

I have two default cubes, the lower one resized to work like a platform.


They have collisions set and the top one has mass and “simulate physics” enabled.
I wanted to make it so that when I set its rotation to 90 the top one would fall down
2
However, when I do this (SetActorRotation) the rotation is changed but the top box does not fall. If I disable and then reenable “simulate physics” it falls down. Similarly if I just destroy the platform the top box falls down.
I’m guessing that the top box is somehow not simulating physics all the time to save cpu but how can I let it know to start simulating again? Is reenabling physics simulation the way to go? Also I might not have / want to have access to all objects that lie on top of other objects so what then?

Knowing PhysX I am just wondering how you are even rotating the actor without catapulting the cube into outer space to start with… Are you waiting for the cube to go to Sleep before rotating the platform?

I am assuming you have an actor with a scene root to which the 2 meshes are attached but are not attached to one another.

How’s the hierarchy of the actor?

There is a big chance that after settling down for some time, the cube is going to sleep.
Normally, a collision would wake it up but I guess removing a collision does not count.
Unfortunately, I am new in UE but I’ve seen this behavior in other engines lot’s of times.

Maybe you can try placing the cube a little higher (so it falls when the game starts) and debugging it with onComponentSleep.

Looks like there was a bug about this and the last post in this thread says they’ve found a solution: Prevent rigid body from falling asleep - #9 by 123pirke

Those are two separate actors, not attached in any way. I’m rotating the ‘platform’ downwards, not upwards :slight_smile:

Does not matter much, depenetration would still kick in:

Consider elaborating on how this done. According to the description this would wake up the simulating object every time. Are you rotating the platform around a pivot in such a way that it does not wake up the potentially sleeping cube?

Even if we ensure the pivot rotation would not interfere, this still seems to work OK:

In short - you’re describing a behaviour that should work OK out of the box. The real question is: what else is going on.

You’ve described Sleep / Wake events:

Enable this and see if both events fire. Perhaps there’s something dodgy regarding the way UE5 handles it.

There’s not much more to describe… That’s just all there is to it. I’m moving the pivot like in the second image you provided, so rotating does not interfere with the cube.
I tested the events you provided and as I expected the cube goes to sleep once it’s not moving for a while. Then when I rotate the platform it does not wake. However, if I put something smaller under it, so that it doesn’t lay flat, it gets awoken and falls properly.

1 Like

A similar thing happened in my project, when physics objects stopped reacting to gravity for some reason, even though they should have been awake.
I setup a looping timer to wake them up once a second, and it worked. I know it’s not a good solution and it just a workaround, but you can try doing that to see if the cube falling asleep is the issue, and you can work further from that.

Was this in UE4 or 5?

Perhaps a more wholesome hack would be to fire a box trace up when the platform rotates, catch all sleeping overlapping simulating meshes and wake them? :sleeping:

Wish I could reproduce the issue. :expressionless:

It was in 4.27, but who can say the same can’t happen in 5.0? =)