Makinom - Game Toolkit for Unity
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom

Schematics

4
  • Setting the Player
  • Simple Character Controller
  • Mouse Orbit Camera
  • Random Waypoints

Breakout

7
  • Breakout Tutorial Introduction
  • 01 First Steps
  • 02 Player Controls
  • 03 Bricks
  • 04 Losing a Life
  • 05 UI Setup
  • 06 Sound Assignments

Space Shooter

12
  • Space Shooter Tutorial Introduction
  • 01 First Steps
  • 02 Player Move Controls
  • 03 Player Weapon Controls
  • 04 Hit and Destroy
  • 05 Asteroids
  • 06 Game Controller
  • 07 UI Setup
  • 08 Player’s Destruction
  • 09 Enemy Ship Mechanics
  • 10 Enemy Ship
  • 11 Moving the Background

Match 3

8
  • Match 3 Tutorial Introduction
  • 01 First Steps
  • 02 UI Setup
  • 03 Generating the Level
  • 04 Matching Jewels
  • 05 Destroying Jewels
  • 06 Game Controls
  • 07 Jewel Setup

Survival Shooter

9
  • Survival Shooter Tutorial Introduction
  • 01 First Steps
  • 02 Player Movement
  • 03 Player Shooting
  • 04 Enemy Mechanics
  • 05 Setting up the Enemies
  • 06 UI Setup
  • 07 Player’s Death
  • 08 Enemy Spawner

2D Roguelike

9
  • 2D Roguelike Tutorial Introduction
  • 01 First Steps
  • 02 Generating the Level
  • 03 Level Generation Machines
  • 04 Player Controls
  • 05 Walls, Food and Exit
  • 06 Game Manager and UI Setup
  • 07 Enemy Mechanics
  • 08 Game Over

2D Platformer

15
  • 2D Platformer Tutorial Introduction
  • 01 First Steps
  • 02 Player Movement
  • 03 Camera and Background
  • 04 Shooting Rockets
  • 05 Enemy Mechanics
  • 06 Setting up the Enemies
  • 07 Enemy Spawners
  • 08 Player Damage and Fall Remover
  • 09 Health Pickup
  • 10 Bomb Pickup
  • 11 Bomb Prefabs and Lay Bombs
  • 12 Pickup Spawner
  • 13 UI Setup
  • 14 Background Animations
  • Home
  • Guide
  • Tutorials
  • Schematics
  • Simple Character Controller

Simple Character Controller

A simple player control using a Character Controller component.

In this tutorial, we’ll create a schematic to control our player using a Character Controller component. The control will allow to move the player around (with the player facing into the move direction) and jumping.

You can download the finished schematic here.

Download Schematic

Input Keys #

We’re using input keys for jumping, horizontal and vertical movement, so set them up as you want them to be.

When downloading the schematic make sure to open it up, change the input keys to use your inputs and save the schematic.

Schematic #

Open the Makinom editor, navigate to Schematics and create a new schematic. Change the following settings.

Check Variables #

Add Node > Value > Variable > Check Variables

First, we’ll check if we’re currently jumping – in that case we’ll just continue to move the game object upwards.

Jumping will set an object variable on the game object to the current time + an offset, when the current time exceeds that value, we’ll stop moving upwards.

  • Condition Type
    Select Variable.
  • Variable Key
    Set to jumpTime.
  • Variable Origin
    Select Object.
  • Object
    Select Machine Object.
  • Is Valid
    Enable this setting.
  • Exists
    Disable this setting.
  • Type
    Select Float.
  • Check Type
    Select Is Less.
  • Float Type (Check Value)
    Select Time > Time.

Check On Ground #

Add Node > Movement > Movement > Check On Ground

We’re not jumping, so let’s check if we’re on the ground to see if we can jump. Since we’re using a Character Controller component, we can check if we’re on the ground without using a raycast.

This node is connected to the Success slot of the Check Variables node.

  • Object
    Select Machine Object.
  • Use Raycast
    Disable this setting.

Input Key #

Add Node > Input > Input Key

We’re on the ground, so let’s check if the player pressed jump.

This node is connected to the On Ground slot of the Check On Ground node.

  • Input Key
    Select Jump.

Move #

Add Node > Movement > Movement > Move

We’re in the air (falling) or on the ground and the player isn’t jumping, we’ll just move normally using the player’s input.

This node is connected to the In Air slot of the Check On Ground node and to the Failed slot of the Input Key node.

Moving Object #

  • Object
    Select Machine Object.
  • Move Component
    Select Character Controller.

Move Change #

  • Vector3 Type
    Select Value > Set Axis.
  • X-Axis
    Select Input > Input Key Axis and Horizontal.
  • Y-Axis
    Set to 0 (Value).
  • Z-Axis
    Select Input > Input Key Axis and Vertical.

Speed Settings #

  • Speed
    Set to 5 (Value).
    You can also use a float variable where you’ve stored your desired movement speed (or a different value).
  • Clamp Magnitude
    Enable this setting.

Gravity #

  • Add Gravity
    Enable this setting.
  • Vector3 Type
    Select Value > Gravity 3D.
  • Use Delta Time
    Enable this setting.
  • Local Space
    Disable this setting.

Rotation Settings #

  • Face Direction
    Enable this setting.
  • Rotation Component
    Select Auto.
  • Lock Rotation X
    Enable this setting.
  • Lock Rotation Y
    Disable this setting.
  • Lock Rotation Z
    Enable this setting.

Change Variables #

Add Node > Value > Variable > Change Variables

The player pressed jump, so let’s set the time to remember when to stop moving upwards.

This node is connected to the Jump slot of the Input Key node.

  • Change Type
    Select Variable.
  • Variable Key
    Set to jumpTime.
  • Variable Origin
    Select Object.
  • Object
    Select Machine Object.
  • Type
    Select Float.
  • Operator
    Select Set.
  • Float Type
    Select Time > Time and 0.25.
    This sets the variable to the current time (since application start) + 0.25 seconds.

Move #

Add Node > Movement > Movement > Move

The player is jumping (i.e. moving upwards), but we also use the player’s input to move. Since this is a simple control, the jump will set the Y-axis to 2, using the double of the movement speed for jumping.

This node is connected to the Next slot of the Change Variables node and to the Failed slot of the Check Variables node.

Moving Object #

  • Object
    Select Machine Object.
  • Move Component
    Select Character Controller.

Move Change #

  • Vector3 Type
    Select Value > Set Axis.
  • X-Axis
    Select Input > Input Key Axis and Horizontal.
  • Y-Axis
    Set to 2 (Value).
  • Z-Axis
    Select Input > Input Key Axis and Vertical.

Speed Settings #

  • Speed
    Set to 5 (Value).
    You can also use a float variable where you’ve stored your desired movement speed (or a different value).
    Note that the the jump speed will be twice that value.
  • Clamp Magnitude
    Disable this setting.

Gravity #

  • Add Gravity
    Disable this setting.
  • Use Delta Time
    Enable this setting.
  • Local Space
    Disable this setting.

Rotation Settings #

  • Face Direction
    Disable this setting.

And that’s it – click on Save Schematic and e.g. save it as SimpleControl.

Game Object Setup #

An example setup for a game object using the schematic.

Object Variables #

Since we’re storing the jump time as an object variable, we’ll need to add an Object Variables component to the game object.

E.g. use the component menu: Makinom > Scenes > Object Variables

You can use the object variables in local mode (i.e. enabling Local Variables) or use an object ID to keep the data alive across multiple scenes (and save games).

Tick Machine #

The schematic needs to be added using a tick machine. Don’t forget to also add an Object Variables component to the game object.

Add a tick machine component to the game object (e.g. using the component menu: Makinom > Machines > Tick Machine) and change the following settings.

Start Settings #

  • Update
    Enable this setting.

Machine Execution Settings #

  • Schematics Asset
    Select SimpleControl (or however you named your schematic).
  • Execution Type
    Select Single.
  • Update Type
    Select Update.

And that’s it.

Schematics
Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on January 19, 2021
Table of Contents
  • Input Keys
  • Schematic
    • Check Variables
    • Check On Ground
    • Input Key
    • Move
      • Moving Object
      • Move Change
      • Speed Settings
      • Gravity
      • Rotation Settings
    • Change Variables
    • Move
      • Moving Object
      • Move Change
      • Speed Settings
      • Gravity
      • Rotation Settings
  • Game Object Setup
    • Object Variables
    • Tick Machine
      • Start Settings
      • Machine Execution Settings
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom
  • Contact
  • Blog
  • ORK Framework
  • gamingislove.com
Categories
  • Makinom 1 (97)
    • Tutorial (97)
      • 2D Platformer (14)
      • 2D Roguelike (8)
      • Breakout (6)
      • How-to (34)
      • Match 3 (6)
      • Schematic (4)
      • Scripting (6)
      • Space Shooter (11)
      • Survival Shooter (8)
  • News (11)
  • Release (72)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!