Unity - Circular Movement. But without coding anything.

Moving in a circle does not have to be coded, ya know?

Timo Schmid
Jun 19, 2021 · 3 min read

We already created a circular movement behavior with the help of math. But you know what? I don’t like math… Like, at all. And hey, it’s okay to hate it, even as a game developer where you need it sometimes. Anyways, let’s create a circular movement today without using math or code at all!

I. The objective
The objective is pretty clear. We shall create a circular movement without using code or math but with the help of the Animator.

II. Creating the actual behavior
We don’t need assets for this animation. We can simply manipulate the position of an GameObject and Unity will do the rest. Really. It’s as easy as that!

Now, all we need to do is to set the positions we want as keyframes inside the Animator, while in Recording Mode!

But first, let’s break it down:

  • We want to create a circular movement.
    Let’s say we start at position 0,6,0 and create four keyframes for the circle

To set a position as keyframe, simply enter the position inside the Inspector and it will be applied for the chosen frame:

Creating a keyframe

Having done that for all five positions we need, your Animator could look like this:

III. The end result
Playing the Animation in Unity will look like this:

Yes, that’s all you need to do!
Trust me, I was absolutely mind-blown when a GameDevHQ coach showed me that this was possible to create without any code! The Animator really seems to be very powerful and it really seems like it will save you time and frustration in many situations. I went through the pain of coding that behavior. 17 lines of code in two hours. That could have been just some minutes… Life of a developer I guess :D

Thanks for your time and interest!
Catch you next time again!

Nerd For Tech

From Confusion to Clarification

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Timo Schmid

Written by

The mission? Becoming a game developer! RPG is the dream! Writing down my journey here for me and for everyone interested. Thanks for showing interest :)

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.