Download

Rotation Help

I have a cube that can be picked up and has one side that faces the player.
I want to be able to rotate it left/right/up/down so that I can have one of the other sides face the player.
I thought this would be as simple as adding or subtracting 90 on the yaw and roll values.
On the first turn this works well but then it effects the cube as if you were looking at the original side.
So if you rotate the front side to be on the top and then press left/right then you are still looking at the same side but the other sides have rotated around it.

How can I get this to work?

Try to add/combine 2 rotations:

Look at this for ideas:
https://forums.unrealengine.com/showthread.php?62610-add-local-Yaw-to-Make-Rot-from-Z

Had a look on there but I don’t think anything there will help with my problem. Thanks though.

Anyone else have an idea?

Hello,
I haven’t try, this is only an idea on the fly but if you use another component (like a collision box) as orientation reference and apply selected rotation to your cube, it would be ok. Or using actor rotation and rotate only component.

Edit : I did a try to be sure : With a “get actor rotation” / “combine rotators” + 90 (for both pitch and yaw)/ set world rotation to component. And it may be what you want.

Thanks for you r reply.
Could you elaborate a bit more on what you did.
How do you use the collision box as a reference?

I wrote it in the edit in the last post : You do a “get actor rotation” or a “get world rotation” of your box if you use a box then add rotation with -90 / +90 for yaw or pitch and then set world rotation to your mesh. (You can add a move component for rolling effect, you’ll just need to get mesh location and set it in the component move)