Simple Animation in UE4

(Rotate Object Indefinitely)

Luke Marsden
4 min readAug 24, 2017

Okay, so say we’re working on an Unreal Scene and there’s this one object that’s static and unmoving and would add so much to the scene if it were in motion.

A ceiling fan, for example

How about we just set the object to spin indefinitely from the very moment we start playing the game instead?

Let’s start by creating a new Blueprint and getting everything set up by adding the object we wish to spin!

Blueprint View — Unreal Engine. (2017)
Add Component — Unreal Engine. (2017)

Click “Add Component” and select the class of object you wish to import into the scene.

Since I already have a fan modeled I’ll be selecting the ‘Static Mesh’ component, but don’t be afraid to use a variety of other components in it’s place.

Your new component will be added to the component directory, name it whatever you like and in the event that it’s a static mesh ensure that you add the mesh you have built to the scene as seen below.

Add Mesh — Unreal Engine. (2017)
Viewport — Unreal Engine. (2017)

Now that we have our object in the blueprint, it’s time to start programming within the Event Graph.

We’ll start by incorporating an Event Tick.

Add Event Tick — Unreal Engine. (2017)
Event Tick — Unreal Engine. (2017)

An Event Tick is a simple event that is called on every frame of game play.

AddRelativeRotation — Unreal Engine. (2017)
Event Graph Progress 01 — Unreal Engine. (2017)

Meaning the blueprint will take effect immediately upon initiating the game.

Next we’ll create a ‘AddRelativeRotation’ coming off our Event Tick with our object attached to the Target input.

We’re using the ‘relative’ rotation because it is exactly as it’s name suggests — relative to it’s target, and since the target is our object it will rotate in relating to itself.

The Delta Rotation details exactly by how much the object will rotate and in what direction. However, this is a single event.
So if you entered 360 into the Z slot, the object would rotate once and then stop.

Make Rotator — Unreal Engine. (2017)

But we want it to go on forever, right?

So instead, we’ll take the Delta Rotation and create a
Make Rotator’ action coming out of it’s input.

This gives us more control over our rotation and creates individual input offshoots for each axis of rotation.

Event Graph Progress 02 — Unreal Engine. (2017)
Viewport + Axis — Unreal Engine. (2017)

Now it’s time to figure out exactly what direction and axis we want to rotate on.

If you’re unfamiliar with the 3 axis of space, just look in the bottom corner of the Viewport and to get a rough idea of the layout.

Float*Float — Unreal Engine. (2017)

Because of the situating of the fan, I will be using the Z axis (aka the Yaw).

What we essentially want is a Rotation over Time, so it’s time to add a little math.

Float * Float takes two float values and multiplies them together to create a value, simple.

Event Graph Progress 03 — Unreal Engine. (2017)
Delta Seconds — Unreal Engine. (2017)
Rotation Speed Value — Unreal Engine. (2017)

The Event Tick’s Delta Seconds value relates to the time in which the Event Tick operates. Since the Event Tick activates every frame in which the game is in play, this means that this has a value of 1 every frame, or something to that regard. Meaning when incorporated with our Float*Float, our Z axis rotation is currently 0.0 every frame.

Changing the value in the box to 10 translates to 10 units of Yaw Rotation every frame. Increasing and decreasing this value will change the speed of the rotation in the scene.

That’s it! If you’re blueprint turns out looking as shown below, your asset should spin indefinitely.
Just make sure you drag the blueprint into the scene to test it, because the static mesh alone wont rotate.

Rotate Object Indefinitely Blueprint— Unreal Engine. (2017)

References

Unreal Engine. (2017). Epic Games.

--

--