x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

alt text

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!

Product Version: UE 4.18
Tags:
more ▼

asked Mar 26 '18 at 02:39 AM in Blueprint Scripting

avatar image

Xenocide7
3 1 3

avatar image Xenocide7 Mar 26 '18 at 09:13 PM

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.

alt text

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!

avatar image Nebula Games Inc Mar 26 '18 at 09:50 PM

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.

avatar image Xenocide7 Mar 26 '18 at 09:58 PM

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

avatar image Nebula Games Inc Mar 26 '18 at 10:19 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question