SOVEREIGN MOON PRESENTS…

Bolt For Beginners: How to Use Unity’s Bolt to Move Objects

In this tutorial you’ll learn how to move a game object without having to have any knowledge or coding whatsoever using Unity’s Bolt visual scripting tool. 

Sovereign Moon Studios is dedicated to helping game enthusiasts bring their creative visions to life by teaching them how to make a video game from scratch without having to know how to code or draw. ⚡

How to Move a Game Object Without Code Using Unity’s Bolt Add-On

Today, Sovereign Moon Studios, the makers of your favorite NoCode game development course, are excited because we just launched a short Bolt video tutorial series and today we’re bringing you the 2nd installment from that series. If you are just joining us now, you should first watch our  Bolt introduction tutorial for absolute beginners.

Let’s jump in.

Introduction to Bolt & Movement

In this tutorial we’re going to talk about how to make objects move using Bolt, which is a free visual scripting plugin that you can download and install from Unity’s asset store.

In the previous introductory tutorial I introduced you to the different components of bolt and helped you better understand the different parts of a unit.

unity bolt basics unit

My goal for this tutorial is to continue teaching you a little bit more about the Bolt programming interface while at the same teaching you how to use Bolt to move an object.

Now object movement can get quite complex and I hope to cover some of that complexity in future tutorials. For example, we’ll be publishing a tutorial that will show you how to use bolt to create a moving platform that your character will be able to jump on and off of, without sliding off. Similarly, in future tutorials we’ll talk about how to set up object movement based on the state a character is in. For example, you might want to set an enemy’s movement to idle when it’s not in combat, but once your character turns the combat zone, you might want to change the movement to the character’s battle movement sequence. In our next tutorial, I’ll also teach you how to use bolt to setup movement triggers. So be sure to subscribe to our channel to get updated when we publish content like that.

But for today’s introductory tutorial, we’re only going to build something slightly more complex than we built in our previous tutorial and now rather than making a cube rotate, we’re going to make it move in a straight line.

In-Game Bolt Movement Example

Again, in order to make this logic less abstract, let’s first look at a real world use case of why you might want to do this. In this currently untitled game which we are in development of in our studio, you’ll see I’m able to use the script I’m going to show you today to move this enemy character through my environment.

So let’s jump back to our cube and learn how to do this.

enemy character movement with Unity Bolt

How to Set Up Movement With Unity’s Bolt?

If you click on our cube you’ll see the flow graph that we set up in the last tutorial. However, we don’t need this transform unit any longer, so let’s get rid of it now. Just click on the unit and then hit delete on your keyboard.

Now we need to set up the movement units. In programming there are two types of calls you use frequently. They are “get” and “set”.

What are “Get” & “Set”?

The “get” method will return the value of a variable and the “set” method will “assign” a new value to a variable.

In simple terms, what we’re going to do today is use a “get” method to take our object from where it is and use a “set” to move an object to where we want it to be.

Now you can do any of the following:

Get an object from its current position and set it to a particular spot within 3D space
You could have it ping pong between two spaces
Or you could have it continuously move in one direction

Again, in order to keep this tutorial as simple as possible, we’re going to move our object continuously in one direction.

So let’s set this up. Now you can get some practice disconnecting units. Remember, simply right click on the port where our rotation transform unit was and now that unit will be disconnected. Once disconnected you can delete the unit.

So now we should just have our “update event” selected here. Again, like rotation, the position of an object within the game world is part of an object’s transform settings. Remember, previously, we looked up here in the inspector tab to figure that out. Here, you’ll see the object’s x, y and z coordinates.

Now we know the unit we’re looking for will be another transform unit. Now, I never showed you this in the last tutorial because I’m trying to expose you to new information slowly to not overwhelm you, but in the last tutorial I mentioned there are two ways to add a new unit, you can either drag a wire up like this, or right click on the canvas to add a new unit. But in some cases, you can also just drag and drop a component from your inspector tab into your graph area. For example, we know that the unit we need will be a transform unit, so with our object selected, let’s just drag our transform component into our graph area.

Now we can click on transform and go through the list of items we can modify. Remember, we’re looking to “get” this object’s position and “set” it to something else. So we need to keep our eye out for units which help us get or set this object’s position properties.

Of course, you could search for these in the fuzzy finder, but I’m just going to scroll down until I see them just to show you different ways to accomplish the task.

And here you’ll see them. We have position “get” and position “set”. So I’m going to add each of these now. Now we simply need to add a unit that will allow us to push our object along on our map. And to do this we can add an “add – math / vector3” unit.

move an object with unity bolt

The reason we’re using a vector3 is because we’re trying to change the object’s position in 3D space. If we wanted to change an object’s position in 2D space we could select vector 2. Now vector 2 and 3 are not just used to move the position of an object, but that is probably the most common use for this unit. As you can see, when I selected this, you’ll notice I have three new input fields where I can insert the x y and z movement that I want to add to the cubes position. So I’m going to type in that I want it to move 0.009 along the x axis.

Play Your Game to See the Results

After that, we can play the game and we’ll notice the object moving.

So we’ll get more advanced in future tutorials, but by adding these few units you can make game objects move.

Thanks for stopping by our game development blog today. And don’t forget, if you want to take your no-code game devs skills to the next level, we offer a comprehensive online no-code game development course where we go into much more detail than we do in these free videos, so if you’re interested in checking that out be sure to check out our homepage. 

Thanks for stopping by today!

Sovereign Moon Studios is dedicated to helping game enthusiasts bring their creative visions to life without having to know how to code or draw. Our NoCode game development course teaches indie game devs how to build breathtaking games from scratch. ⚡

Want to Make Video Games?

Do you love game design? So do we! For this reason, we created a no-code video game development course that walks you through the process of bringing your game visions to life without needing to know how to program and without having to be an artist. We will teach you how to bring your game to life in our 4 hour 36 module no-code game development course.