Skip to content

Character Movement

Unbound ships with a pair of logic blocks and a rigged humanoid puppet to make creating a playable character easy.

Overview

This article covers how to add the character puppet rig and connect it to the characterController and characterPuppet so that you, and the character, can be off and running in just a few clicks. This will not be an exhaustive guide to every property of these logic blocks but it'll more than get you started 😄

Related Information

If you're unfamiliar with visual scripting, consider reading Unbound's Logic Block Basics before continuing.

If you'd like to follow along or see the finished product you can download the file here.

Download Project

Logic Blocks Used in This Example

  • characterPuppet for setting up poses and character defaults
  • characterController for keyboard input and character movement

Adding the Character Puppet

Start by opening the Logic Library (1) and then drag the characterPuppet logic block (2) into the scene. This will generate a logic block as well as the rigged puppet. If the puppet is floating in the air don't worry, we'll fix that in a second.

unbound screenshot showing a rigged character puppet and the characterPuppet logic block

The characterPuppet logic block gives you the ability to control the puppet with other logic blocks (or code) as well as within the editor. For example, this logic block allows you to snap the puppet into different poses (e.g. rest, jump, T, etc) so that you can adjust those animations to fit your game or, in the case of the T-pose, make it easier to re-skin the puppet with your design.

First, let's bring the puppet back down to earth. Click the purple dot between his feet. Now that the transform gizmo is visible, grab the green Y-Axis handle and drag him closer to the ground. It doesn't have to be perfect, we'll set the exact ground height shortly.

XXX

The purple dot is the parent of the character puppet (it's a Joint) and you may notice that it's connected to the character input on the characterPuppet logic block. This is what allows the logic block to "talk" to the puppet.

When you're done, it should look something like this.

XXX

Warning

XXX If you accidentally disconnected the puppet from the block, don't worry! Just click the dot next to character in the logic block and drag the connection back to the purple dot between his feet. The tooltips show the name of the joint or model you're about to connect to - you're looking for character.

Accessing Different Poses & Animation Properties

Clicking the icons at the bottom of the characterPuppet block will allow you to edit the poses and change the animation properties of this puppet.

Save Your Project!

Before we continue, now would be a great time to save your project. Click the Library icon near the upper left then click Save. If you change the name in the field above the save button it create and save a copy of this scene in your project (this is unbound's equivalent to Save As)

Example: Edit Jump Pose

If you click the icon of the running person at the bottom of the characterPuppet logic block it will allow you to select different poses for editing. Click on edit jump pose and then manipulate the joints into the position you'd like to use for your jump.

gif of character puppet's jump pose being edited in unbound

That's it! Now when your character jumps, it'll take this pose instead of the default. Now let's set up the characterController so we can test this out.

Adding the characterController

From the logic library, find the characterController logic block and drag that into the scene. Unlike the characterPuppet block, this one does not come connected to the puppet by default so we'll need to do that now.

Drag a connection from the character input of the characterController to the parent of the puppet (the purple dot between the puppet's feet)

Now your project should look something like this:

  character puppet in unbound connected to characterPuppet and characterController logic blocks  
Because we're going to connect the characterController's outputs to inputs on the characterPuppet block, it'll be helpful to position the controller to the left of the puppet block.

characterController

This block allows you to define the character's properties, such as movement and rotation speed. It also defines some other values like gravity, jump speed, and even a tag to report collisions.

default keyboard input for characterController in unbound Keyboard input is built into this logic block with the following default values but you can change them to whatever you'd like by entering a different key for each action. Out of the box, WASD will move your player, Right Shift runs, and SPACE jumps.

It also captures keyboard input and translates it to values the characterPuppet uses to change the state and position of the puppet.

characterPuppet

This block is responsible for setting the position and animations on your puppet model which typically come from the connections we just made to the characterController. Aside from using it to toggle between poses so you can edit them within unbound, you likely won't do as much in-editor with this block as you might with the characterController.

Make it Run!

As a final set, connect these 4 output to the 4 matching inputs on the characterPuppet. It should look something like this with both blocks connected to the puppet and the characterController wired up to the characterPuppet

XXX

If you've connected everything properly, you can now test the project by clicking the play button(1). You will also need to enable input (2) while running so that unbound will accept key presses.

XXX

You can move around with the WASD keys. If you hold RIGHT SHIFT while moving you'll notice the puppet switches to the run animation while pressing SPACE causes it to jump (which should show the new jump pose we created)

Extra Credit

As promised, we're going to address the player falling through the ground.

image of character puppet stuck in the ground in unbound

You might notice that his feet are disappearing through the grass, which might be what you want considering the type of grass. But presuming it's not, let's fix that.

While the ground height can be set based on calculations from the characterContrller that's outside the scope of this tutorial. We're simply going to set this value manually using the groundHeight input of the characterPuppet.

By clicking on the groundHeight field you can enter the Y value you'd like the puppet's feet (the purple dot) to be at. Don't know the Y value? Me neither, but don't worry, we're going to set our values live while the game is running!

Press the play button to start the game. The player will snap to the ground height. Now, we can just click the numeric steppers on either side of the field to move the puppet up or down until it looks about right. If you can't get it exactly where you'd like, once it's close enough you can click on the field to see the value and change it to the exact right number.

For me, the steppers get it to 0.20 which looked good but I then edited it to 0.25 by hand to get it just right.

Now, when we stop the game the puppet will return to its in-editor position but the value you entered is now saved and will be used the next time you play!

adjusting puppet's ground height in unbound

Now go experiment with these logic blocks to see what else you can do with it!