Basic character movement

You are here:
< All Topics
Table of Contents

In this tutorial we will create a basic character movement graph which reacts to the input axis and jump button. For this we will use the Unity character controller. All this is done with only 6 nodes!

Scene setup

Let’s create our basic scene first.

  • Add a simple plane set its scale to 10, 1, 10 and position to: 0,0,0
  • Add a capsule object and set its position to: 0, 1, 0
  • Add a character controller component to the capsule object¬†

Before we can start creating our graph we have to setup our blackboard first with some variables.

Create a new blackboard. Right click somewhere in your project view and choose FlowReactor / New Blackboard. Name it as you like. Select your newly created blackboard and add a gameobject variable which we call “Character”. Next, add two float variables. Name them “HorizontalAxis” and “VerticalAxis”.

The last variable we will add is a boolean which we call “IsJumping”.

Create graph

We can now create our character controller graph.

Right click in your project and choose FlowReactor -> New Graph. Name it: CharacterControllerGraph

In your graph go to properties and select blackboards. Now add your blackboard to your graph by simply dragging it on to the inspector.

Input Axis nodes

The graph needs to constantly listen to the players input axis (horizontal and vertical) and set those values to the character controller. To do this we have to create a loop which gets the input axis and stores the result in the two float variables in the blackboard which we then can pass to the character controller.

So lets add two GetInputAxis nodes to our graph and connect them together. We will also connect the OnStart node to the first GetInputAxis node.

Now select the first GetInputAxis node. In the node inspector we can now add the axis name we want to listen to. (The axis names and general input names can be set in the Unity Input Manager: Edit/Project settings/InputManager).

So for the first GetInpustAxis node we add “Horizontal” to the axis field. We also have to connect the result field to our blackboard “HorizontalAxis” variable. This is where the result will be stored.

Select the second GetInputAxis node and add “Vertical” to the axis field. Connect the result field with the blackboard “VerticalAxis” variable.

Input button node

Next we add a GetInputButton node. Connect it with the last GetInputAxis node. Select the GetInputButton node, choose “Down” as the input type and type “Jump” as the button. Now we also have to store the result to our blackboard variable “IsJumping”. Click on blackboard and select the variable “IsJumping”.

Character controller node

Now we need to put everything together. Lets add a CharacterController node. Select the node and connect node variables with the blackboard variables.

Controller -> Character
Horizontal -> HorizontalAxis
Vertical -> VerticalAxis
DoJump -> IsJumping

Add additional local values to our character controller:
Speed -> 5
JumpHeight -> 2

You can of course change the values as you’d like.


This graph needs to run in a loop to make sure our values are constantly updated. To do that we simply add a “Repeat” node to our last node which is the CharacterController node. Then we connect the repeat output with the first GetInputAxis node. Now we have created a nice loop. It is important to create loops with the repeat nodes instead of connecting them directly. Otherwise you would create a stack overflow exception!

Last steps

Our graph is done!
Now add the graph to the capsule. Simply drag and drop the graph file on to the capsule object. 

As a last step we have to assign our character variable. As it is a scene object we have to enable the override on the FlowReactor component.

  • Select the capsule object
  • In the blackboard scene overrides you’ll find the Character variable.
  • Enable the override option and drag the capsule object on to the field.

You can now hit play and move the capsule object around with the arrow keys or WASD.

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Consent to display content from Youtube
Consent to display content from Vimeo
Google Maps
Consent to display content from Google