How do I lock the rotation of an Actor rotated by a key press?

Eventually, what I wish to achieve is a touch input where swiping rotates the Actor between 70 and -70 degrees on the X axis.
I’m hoping to get it working so that swiping left will make the Actor rotate one way, while swiping right makes the Actor rotate the other way.

So far I’ve managed to get an Actor to rotate continuously on the X axis by holding down the ‘J’ key:

I’m not sure how to make the rotation stop at 70 degrees on the X axis. Could someone help me with this?

At the top of the Blueprint you can see I’ve tried to add a Boolean to check when the rotation of the Actor reaches a certain point, but it doesn’t seem to register at all.

If I can figure out how to limit the rotation of the Actor once it reaches the desired rotational point, hopefully I can then figure out how to apply it to Touch Input so that I can eventually get a swiping rotation going!

Appreciate the help in advance!

Okay so it turns out I was using the wrong function attached to Get Relative Transform, so I replaced Set Parent Component with Get Owner, attaching the Static Mesh Component variable to the Target.

I also added a branch to the ‘J’ key event so that when the angle is reached, the ‘J’ key Is Pressed boolean will return false, meaning everything from the Event Tick will break, since Is Pressed must be true in order to run the Event Tick branch.

The last question I have is, does anybody know how I can substitute the ‘J’ key event for Input Touch swiping? I want to be able to swipe left and right in order to rotate the actor, instead of doing it by pressing the ‘J’ key.

If someone could point me in the right direction to do this it would be much appreciated!

Ah okay thanks! Do you know if it determine swiping left or right already or do I have to declare all that myself?

There is an “Input Touch” event, you can use that and try using the “move” execution, that fires off like a tick as long as a finger is down.

It doesn’t know which direction you are swiping, you would have to script that logic yourself. All it does is continuously fire for as long as your finger is touching the screen. So it can be used for a swipe event.