Both Rotating and changing Offset/Location an object? --- Answer found! ---

Hey all!

For a VR simulation I’m working on; I have a rectangular window frame, a button to rotate the window frame, and a tilted table that the window frame is sitting on. When I rotate the frame, it hangs over the end of the table, and I’m unsure on how to keep the frame on the edge table.

Linked is a video of the rotation mentioned, as well as the level blueprint that I’m currently using to rotate the frame. (There are 3 tables in my level, the 20 degree table is the one in the video)

With AddActorWorldOffset the frame moves away from the table as you continue to push the button.
I’ve tried AddLocalOffset with a little bit of progress, but atleast one side still hangs over.

Any suggestions on what I can add to the blueprint to move the frame properly? Maybe a method to set up the button so that every press is a different offset?

You have the rotation down, but the only way to get the window sitting right on the table when it’s ‘vertical’ is to also shift the location.

You need to shift it up ( I don’t know the orientation of you axis ) when you have it vertical. So add enough to move it up, and then subtract enough to move it down again, when longways.

Use AddLocalOffset to the axis pointing up the table.

Does that make sense?

The axis on my length is the y-axis.
When I attach AddLocalOffset, it works to an extent. Here’s a link to a video example.

Adding the amount needed to move it up works on only one side; then when it gets to the opposite side it’s moved either further off the table (when I add -10 to the y-axis offset) or too far into the table (when I add +10 to the y-axis offset).

Well, you’re not trying to animate the turning, so I would recommend just placing it at specific coordinates you know are going to work, instead of trying to rotate it.

SetActorLocationAndRotation X, press button, SetActorLocationAndRotate Y ( just put the window in the right position and look at it’s transform ). ( you can right click on coordinates and use copy and paste )

copy.JPG

Like that. Any good? :slight_smile:

***MultiGate ***was what I was looking for! It works similar to a sequence, but lets me shoot out different actions per button press.
Rather than keeping the previous rotation and offset nodes and changing the one out of place offset node, I changed the transform each time for a more precise movement.

Now my window frame rotates perfectly without sitting too far up or off the table!