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"

Issue with rotating an object in increments - player controlled

Hi there, I'm currently having trouble implementing a game mechanic in my game prototype. I want to rotate an object in the game through player input, but rather than it being a simple animation through matinee I want it to be the core mechanic allowing the player to rotate this object at any point during the game along any of the axis.

Currently, I am working on a simple pyramid object to get the mechanic working. I want it to rotate at 90 degree increments by any axis, one at a time. This will be done via player input, for example: Pressing up once to rotate it 90 degrees through pitch. I want it to be able to go in any direction at any time. Only ever in set intervals of 90 degrees, not free flowing.

Currently, I have a blueprint that makes the object rotate by 90 degrees along Pitch. It works fine at first but then changes direction when it shouldn't do. I want it to keep rotating in a continuous direction, not come back on itself.

alt text

Here is a GIF of the current problem. http://i.imgur.com/HbZfcPN.gifv

Product Version: Not Selected
capture.png (228.8 kB)
more ▼

asked Nov 21 '14 at 02:42 PM in Blueprint Scripting

avatar image

43 8 14 21

avatar image Invisible Dec 24 '15 at 11:38 PM

Hey! Know it's been over a year, but you have exactly what I need and can't find it anywhere... What does your timeline look like to allow that smooth movement of the pyramid? Mine currently just snaps from 90° and I'd like it to smoothly rotate! Please do let me know!

avatar image AndrewHurley Jan 03 '16 at 07:10 PM

Hey Invisible,

Perhaps the below image can help. Since you are incrementing, you will want to Play from Start, and set the rotation to be over a 0 to 1 change. 0 representing the start of the rotation, and 1 representing the finished rotation. This will be a linear line from 0 to 1 over X amount of seconds.

Incremented Rotation along Timeline

alt text

Let me know if you have further questions.


Andrew Hurley

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

1 answer: sort voted first

Hello DanSaxon,

I recreated your blueprint to see if I was able to reproduce the outcome you were experiencing which was indeed the case. I tried tweaking your set up a bit to test out different outcomes all with different and varying results. I was almost able to get it to work with the "Move Component To" node, but as soon as I went from 180 degrees to 270 degrees the mesh did some twisting and turning and re-positioned itself instead of a clean rotation of pitch. This is something I will look into further because it seemed to only happen with Pitch, and not the Yaw or the Roll factor.

That being said, I was able to get the correct outcome of what you are looking for (hopefully) by adding a couple of nodes in the construction script and changing up the logic a bit. We still are using a Timeline and Lerp in between a rotation variable we create and a float vector. Follow the instructions given and use the images on this post as reference on how to set up your blueprint correctly.

Steps to Follow:

  1. Open your current Actor blueprint, or create a new one.

  2. Assign a Static Mesh in your components tab to your blueprint. In your case whatever you are attempting to rotate.

  3. Go into your 'Event Graph' and click on the 'Construction Script' tab.

  4. Use the image provided to Set up your blueprint logic. You will need to create a Rotator variable and label it whatever you would like. Something that makes sense like, 'Rotation'.

  5. Now go into your 'Event Graph' and use the second image as your reference how to set up your Blueprint on a key press.

  6. Keep in mind my 'Timeline' is a linear zero to one time frame.

Construction Script alt text

Event Graph alt text

After getting everything connected, double check to make sure it matches the images and press play. Hopefully when you press the key you have assigned to the rotation, it gives you the desired effect. Keep in mind if you mash the input key it will continually reset the rotation position until it has completed its rotation.

I hope this helps clarify some of the questions you had and gets you on the right path!


Andrew Hurley

more ▼

answered Nov 24 '14 at 03:17 PM

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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