• News

• Industries

• Learning & Support

• Community

• Marketplace

Unreal Engine 4, how to modify world axis while preserving gravity

I have the following scene:
There’s a room with a pressure plate that opens a door for 2 seconds, a cube, and a sphere.
The player has to simply exit the room.
The sphere and the player itself can activate the pressure plate, but the cube cannot.

Also, the player cant activate the pressure plate and make it to door in time.

I want to make it a bit more interesting, by rotate the whole room by 5 degrees, so even if the player wants to grab the sphere and put it on the pressure plate, the sphere will roll away, and the player still won’t make it.

He will have to block the sphere with the cube (so it wont roll away), and only then can get out.

I’m encountering a problem when I make the door open after hitting the pressure plate:

The door is initially rotated 5 degrees around the X axis (green rotation, consider it as the depth axis), which looks fine as in the upper picture.

But after the opening (looking at the bottom pic), having a rotation of 5 degrees around X and 90 around Z (the blue rotation, height axis) makes it look really weird, since it is not rotating around the Z axis of the “biased world” .

I thought about simply changing the world’s axis, instead of calculating the transition matrix between the two axis systems, and then I could just rotate the door 90 degrees around the biased world’s Z axis, of course while preserving the original direction of gravity.

If there are any other solutions I’ll be glad to hear them as well

EDIT: I’ve come up with another solution, which is simply rotate the door around the vector representing the Z axis in the “biased world”, and yet I can’t find a way to directly rotate an AActor around a given vector.