# How to rotate a static mesh object based on its position?

I want to rotate an object based on its position. There are four different positions which are Position1: 60, -25, -10
Position2: 60, 42, -10 Position3: 60, -25, -80 Position4: 60,42, -80. Based on the side it’s on, left or right I want to rotate it the same way. So if it’s on the left side I want to rotate it to the left and if it’s on the right side I want to rotate on the right. I attached a picture with 4 different Box Collisions as position representation, but the test object or wood-looking object will be what’s moving.

In my current blueprints, I tried to start off by making it so the condition was based on its current location and rotation values. If these current values were true it would rotate the object by (0,0, -45) or to the left. If the values were False or didn’t match these values it would reset the object back to its normal location. Currently, all the blueprints do is rotates the object and you can’t rotate it back. The key also works when the object is in any of the 4 locations when it should just be the one based on the conditions.

What am I doing wrong with my blueprints currently and after I finish it how can I make the InputAction rotate appropriately for each location without having to change the InputAction?

Thank you for taking the time to look at my post. Please let me know if there is anything you need me to clarify. I’m new to unreal and blueprinting and appreciate the help!

Ah, I get you. Like this:

@ClockworkOcean Thanks for your reply! I hope this makes things understand. Yes, it is a shield position.

@ClockworkOcean I made this diagram to explain what I mean. I could have explained it a bit better for sure. I can move the shield around already, however, I was trying to rotate it.

Ok, second attempt, you need to put your locations in an array like this:

Then, you can position the shield like this:

and change it’s rotation with:

Oh I see! I originally had the keys in separate functions, but setting it in an array makes it more useable for other functions. I appreciate the help! I have one question. Is the Variable with the relative rotations for x,y,z values a custom-made variable? Because after searching through the possible actions the only thing I could find close to that variable was this. Or maybe it’s a plugin?

Right click on the output pin, and choose ‘split pin’…

Thanks! I edited the blueprints based on what you taught and showed me. Originally when the shield was rotated and the location was changed it would keep the same rotation when switching to the left or right side. Now when you set the location the rotation resets to default with the changes.