Download

Fan rotation on key press

Hi all. It’s probably really straight forward, but I’m pretty new to blueprints. I have a rotating fan in my scene, but I’d like the ability to be able to switch the rotation on/off by pressing a key. I’ve attached a screenshot of my setup. Is there a quick easy way to do this? I’m also wondering if there is a way to fade the rotation in and out, as opposed to it going from zero to full speed in an unrealistic way. Appreciate any help!

All you need to do is searching for “UE4 Timeline” on youtube. It took me 10s to make it work (after watching the video).

AddRelativeRotation on your tick function, or as he said above, just use a timeline to drive a float that you can plug in to your rotational axis.

If he does it with float it makes basicly no sense. He can do a timeline with 0-1 and then take the output and multiply the float by 360 and will also work :slight_smile: Or just take the “Delta Seconds * 360” + “Fan Rotation Float” and just add the delta seconds*360 + fan rotation and then = set fan rotation = will make it spin BUT! if you stand in a lvl or if this fan is on your plane or character, it will end with a float of 9142014771024701.412 or something. So it’s better to do a timeline from 0-360 and set the fan rotation variable and loop it when it finished or make it 0-1 value and multiply the output by 360 and you get the same result, Except if you make 0-360 the numbers are so high that you can’t see 0-360 lol.

If it takes 10s to make, why not post a solution and waste time debating it instead?

Untitled.png

It’s a Rotating Movement component in OP’s pic - no need for Tick. And *float *is perfect for this.

@**replica101: **You’ll want to hook it up to a custom event rather than use Left Mouse Button like I did. The *Timeline *here will raise the rotational speed from 0 to 720 and back, over 3s, and with the same trigger thanks to the *FlipFlop *node. It can be interrupted at any time and will spin back down to 0. Not sure if a more efficient or straightforward solution exists. Someone will surely correct me if they can :wink:

Thank you all. @Everynone - this is awesome. I’m not great with Blueprints so this is a little out of my comfort zone, but I’m going to work through it and hopefully learn something :slight_smile:

Appreciate you all.

I fail to see where you think a float makes no sense? A fan spins on only one axis, so just drive a single axis with a float value either on tick or with a timeline.


If you want the fan to spool up to speed, then–

There are plenty of ways to do this and these are only a few solutions. I’d definitely say the better option is to use a timeline because you can precisely map your curve and it isn’t running when it doesn’t need to, but it’d still be driving a float. @Everynone 's solution using a timeline is perfect, so just explore :smiley:

Thanks guys. So one more rookie question. Would this all go in the level blueprint, or the actor blueprint?

Actor blueprint, keep in the fan. This way each fan can spin on its own.

Unless you have a really unique setup and a fan needs to share this Timeline with something else. Or if you wanted to have 1000 fan actors rotating together - then having 1 Timeline driving them all would be more convenient than 1000 separate ones; arguably. :slight_smile:

@Everynone - where do I find this one? I added a set rotation rate but it doesn’t give me the delta options that you are showing.

Drag a wire from Rotating Movement - a lot of the UE4 nodes are context sensitive.

edit: oh, you mean the pins! Right click the pin and split. Alternatively, you can just make a rotator instead.

Awesome! Thanks @Everynone :):slight_smile: