In my game (Used To Be by heiden.bzr, Arkady, DevilXrom, iPhen), there’s a mechanic where the room rotates when a key is pressed. The entire room, along with everything inside it, starts rotating around a specific axis until it turns 90 degrees. This is implemented through a class called BP_Room
, which acts as the root and rotates as intended, while the actual geometry of the room and all objects inside it are simply attached to it.
The expected behavior is that the player begins sliding and eventually falls from the floor, which is now becoming a wall. It’s also expected that if the player was standing close to a wall that is about to become the “ceiling,” they would collide with it and be “pushed” back into the room.
Instead, the capsule just ignores this “above” collision, which results in the player getting stuck in the geometry or falling out into the open space outside the room.
I’m rotating with the Sweep
parameter enabled, and I tried rotating both the actor and its root, but it seems like Sweep
doesn’t work properly on attached geometry anyway.
I also tried enabling CCD (Continuous Collision Detection) on the player’s capsule, maxing out physics substeps, and implementing a hack where the player constantly moves back and forth using Sweep
. None of this had a strong effect, and it’s still fairly easy to clip through the room.
Physical (simulated) objects also have a high chance of falling through the room when it starts rotating.
I’ve tried everything I could think of, and the only thing that seems to work is having the room’s geometry as part of the root component of the rotating actor, and simulating physics on it during rotation. But that leaves the open question of what to do with the other objects inside the room.
I’m starting to get the horrible suspicion that to handle collisions correctly, I might have to make every movable object simulate physics and constrain them with physics constraints.
I’m writing this in hopes of finding out if there’s an intended way—or at least a good practice—because this doesn’t seem like a unique problem. I sincerely hope there are better options than “just make everything simulate physics.”
Please let me know if there’s something else I need to specify to clarify the problem.