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"

Rotating an object 45 degrees, plus & minus, in blueprint.

Hi! Thanks in advance to anyone that can help.

As you can see below i have a blueprint attached to cylinder and i'm trying to press a button to rotate it 45 degrees on one angle but to rotate it -45 degrees on the same angle if another button is pressed (though i'm sorting it out so that the two cannot be pressed at the same time or during rotation, it's very hacky atm).

i used this solution as a reference to what i'm trying to do https://answers.unrealengine.com/questions/35356/rotate-an-object-over-time-when-pressing-a-key.html but the issue is when i try to go activate Q rotation to rotate opposite E nothing happens. i've messed around with what i thought might be the issue, but nothing seems to get my object to rotate the opposite way by 45 degrees. if anyone has any suggestions (and improvement advice would be great too!) then i'd be all ears, though i must ask if you could explain your changes clearly as blueprint is new to me (and a bit alien) so stuff like custom functions go right over my head unless explained.

Thanks for your time!

alt text

Product Version: Not Selected
rotate.png (158.7 kB)
more ▼

asked Mar 24 '15 at 09:20 PM in Blueprint Scripting

avatar image

1 1 2 1

avatar image Nanoxin Mar 24 '15 at 09:53 PM


could you try 315 degrees rotation instead? If that works you might use some simple math nodes to always keep positive degrees :) (Like this: (WishedDegreePlusOrMinus + 360) % 360)

avatar image Drakmon Mar 24 '15 at 11:13 PM

Would it be cheeky to ask what that may look like in blueprints, the system is rather new to me

avatar image Nanoxin Mar 24 '15 at 11:21 PM

Let's first try to replace the -45 with 315, if that works I'll show you a screenshot on how to do the math stuff ;)

avatar image Drakmon Mar 25 '15 at 12:31 AM

Ok so setting it to 315 makes the object rotate 315 degree's counter clockwise, instead of -45 degrees clockwise, but it does do something, compared to setting degree's to -45, which does nothing.

avatar image Nanoxin Mar 25 '15 at 07:32 AM

Yeah I thought about that, too, too late though.

The problem is probably the branch node, checking if degree is > 0. If degree is < 0, the rotation doesn't get set, just remove that node and connect the event to the set degree node :)

avatar image Drakmon Mar 25 '15 at 04:16 PM

I see where your coming from, but removing it just causes the object to never stop rotating.

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

1 answer: sort voted first

No need to make this complicated actually. Right click anywhere and click on "add timeline" this would create a special type of node that would play for a duration, that can loop and gradually affect values. WHen you double click it you will be greeted with the timeline. Click on the "f+" button to create a float value that's changing over time. Shift+clicking creates points for this variable. You can then go back to the event graph and see that now your timeline has a float in put use this in combination with the execution pin to achieve what you want.

more ▼

answered Mar 25 '15 at 11:54 AM

avatar image

2k 62 24 111

avatar image Drakmon Mar 25 '15 at 04:14 PM

Cool this seems interesting, few questions though, do you mean by the f+ button to create a function that has a ticking float contained in it? could i not just use delta time? do you have any links to documentation on using the timeline node, it seems interesting but nothing in the realm of what i've used so far.

avatar image Drakmon Mar 25 '15 at 05:11 PM

Ok! i got it partially working, i can rotate 45 degree's on button press! and i can rotate back the opposite way using timeline reverse! new issue, i can't rotate more than 45 degree counter clockwise, and ofc can't rotate clockwise unless i've done the counter. here's an image of what i did in blueprint alt text

the level is a clyinder with 45 degree angles and i am trying to get it so i can rotate the level on button press either clockwise or counter clockwise so i need to set up the timeline to always rotate clockwise 45 degree's with one button push and counter with the other. can timeline support this? will it be able to rotate 45 degrees again after playing a 45 degree rotation? as the main issue i'm having is it seems to reset on a new play button.

r2.png (134.3 kB)
avatar image alperenakyuz Mar 25 '15 at 06:50 PM

Create a second timeline instead of reversing the same one. You can duplicate the one you have right now and set the floats to negative.

avatar image alperenakyuz Mar 25 '15 at 06:52 PM

Just make sure that starting one also stops the other one. You can use a sequence node for this and use the first execution pin to stop the other timeline and the second pin to play the new one from start. Playing from start is crucial for what you're trying to achieve.

(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