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 can I make pawn rotate exactly 90 degrees on Y axis with one button press?

I am making a top down game. I have rotation control of the possessed pawn mapped so that you use Q and E to rotate on the Y axis. I need to make it so the pawn ( which is box shaped ) rotates left or right just to the point where the next face of the mesh faces upwards then stops, for each time the buttons ( Q or E ) are pressed and released.

Product Version: Not Selected
Tags:
more ▼

asked Jun 19 '14 at 10:33 PM in Blueprint Scripting

avatar image

daniel311311
3 4 6 7

avatar image DawnTreader Oct 18 '15 at 04:54 AM

Hello

I am also interested in how to make this work on the players actor. I have been trying to set up a system where the player actor only turns 90 degrees left or right. I am using the starter content and have followed the endless runner video tutorial for some of the code that I needed. the 90 degrees turn kind of works. the problem is when the player holds the key down it becomes a 45 degree run.

here is the relevant blue print code:

alt text

alt text

alt text

alt text

so if anyone can help with this it would be greatly appreciated.

(comments are locked)
10|2000 characters needed characters left

4 answers: sort voted first

Ok I have setup a demo.

Demo video: Rotating cube demo

Blueprint component setup (notice that spring arm rotation is absolute)

alt text

Blueprint Event graph alt text

I have mapped 'E' to 'RotateClockwise' and 'Q' to 'RotateCounterClockwise' (both are Action mappings)

component.jpg (202.8 kB)
cblueprint.jpg (340.0 kB)
more ▼

answered Jun 22 '14 at 06:51 AM

avatar image

mindfane
3.3k 154 50 271

avatar image daniel311311 Jun 22 '14 at 03:38 PM

Awesome! Thanks, I had figured out a way to do it. But the way I did it myself it rotated instantly, I actually wanted to be able to see the transition being made like in your demo. I'm gonna implement this asap.

avatar image daniel311311 Jun 22 '14 at 03:41 PM

One more question though. What is the node that is in between 'Get Actor Rotation' and the 'Branch' Node?

avatar image Erytriel Jun 01 '16 at 06:36 AM

it's called "not equal to" , when A is not B it returns true :)

avatar image mindfane Jun 23 '14 at 04:24 AM

Thats a 'Not Equals (rotator)' node.

If your issues is solved, dont forget to mark the thread as 'Solved'

avatar image Porshe911 Nov 16 '17 at 11:05 PM

Thanks mate. I was looking for it a long time.

(comments are locked)
10|2000 characters needed characters left

Couldn't you use Set Actor Rotation node?

To rotate exactly 90 degrees, you could eitehr add 90 degrees to current rotation using the 'Combine Rotator' + 'Make Rot' nodes, and then feeding it as the new Rotation.

To transition smoothly, use a Lerp node

I'm not sure about this, but I think I saw a node named 'Set Delta rotation' or 'Set rotation offset' somewhere in the blueprint. Perhaps those will do this for you.

more ▼

answered Jun 20 '14 at 02:59 AM

avatar image

mindfane
3.3k 154 50 271

avatar image daniel311311 Jun 20 '14 at 05:35 AM

Ok, the way I had it before was 'InputAxis Roll' with 'Axis Value' going into 'Make Rot' (hooked into roll) and the 'Input Axis' plugged into execute 'AddActor Local Rotation', with 'Make Rot' plugged into the delta Rotation. I see the 'Set Actor Rotation' node you are talking about, but where do I hook it up at?

Thanks for the response by the way.

avatar image mindfane Jun 20 '14 at 06:36 AM

IF you always want to rotate 90 degrees, why worry about axis values? You only need to consider the sign (to decide whether to rotate clockwise or counter-clockwise)

Set Rotation is a node that is available in the blueprint. Simply start typing it and you will get it. Put self as the target (default). The new rotation calculated by adding (or subtracting) 90 degrees should be the input. To transition smoothly, you can use a Lerp node and feed its output to the Set Rotation node.

If you still cann't get it right, I will try to create a blueprint myself and put it here (will take 10 hours though - I not at my place right now)

avatar image daniel311311 Jun 20 '14 at 03:18 PM

Sorry in advance for being such a noob, I'm pretty much just starting out learning this. I had it set up to that the mesh rotates to the left when Q is pressed and to the right when E is pressed. Using the InputAxis Roll was the only way I knew how to do that. Yeah if you could show me an example that would be Awesome.

(comments are locked)
10|2000 characters needed characters left

Can someone explain how to set it for the character?

more ▼

answered Oct 03 '14 at 04:55 PM

avatar image

WhiteFennec
1 2 3 3

(comments are locked)
10|2000 characters needed characters left

Can i assign that to my player?

more ▼

answered Oct 03 '16 at 12:52 PM

avatar image

Gazu
1 1 1

(comments are locked)
10|2000 characters needed characters left
Your answer
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