2.5D Platform Initial Setup — Character Controller

Objective: initial setup of the game objects and of the Character Controller

The next project in my “to do” list is platform. I’m going to go with a 2.5D setup, meaning that the gameplay will take place on 2D but all objects and effects are actually 3D.

The first thing we are going to do is to place some basic, prototype platforms, and prefab them for later use. Platforms for now are just cube game objects, rescaled to a more rectangular shape.

We’re going to have a box collider component, not as trigger, the will help the engine evaluate collisions and similar behaviours. We are not adding a rigid body here: we don’t want the platform to be subject to physics.

I scattered 5 platform around, in the future some of them will be also moving.

Let’s now prototype a collectible. Nothing better than a coin for this game genre! The coin will be a cylinder, rotated and scaled to be as flat as a coin. I’m going to prefab also this but final object is going to be an empty parent containing the coin object: in this way I plan to apply a loop rotating animation to the coin while maintaining an outer, unrotated transform.

Now the player: it will be, as usual, a capsule while we work in prototype. Player movement and interaction with the world will be implemented with the help of the Character Controller component.

The Character controller allows an easy management of its carrier movement, including collision with other objects, without the necessity of taking into account physics (so also here no rigid body component is needed).

This is a good choice for this kind of game: we are not looking for a realistic physic in (this) platform, so we can have lighter assets and lighter engine calculations. You can also notice that the character controller has some familiar properties, such as slope or step, typical of a navmesh agent. This means that by simply using this component, our player will be able to move (via script), be stopped by walls and object and climb slopes and steps of certain values. No physics involved, no floor baked.

Let’s finish this tutorial with a simple implementation of player movement. A new script. PlayerMovement is needed.

It is as simple as it gets! Grab reference to the character controller component via GetComponent<>() method, call its Move() method that requires a vector3 (relative movement).

The vector3 will be evaluated as the static Vector3.right (1, 0, 0), so no need for instantiation, multiplied by the horizontal input axis, scaled by the speed and Time.deltaTime , since this is going to be called in Update() so every frame!

Ooops! No physics means no gravity! We’re going to need to script our own one!




A professional developer with passion for game developing and skill-growing. A former Nuclear Physics Researcher who changed his life to pursue his dreams

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Python 3.7 on Apple Silicon

Induction Experience

Apache Airflow in a Digital bank Production

Setting up GitBash with SSH on Windows

From One Code Newbie To Another: my journey so far.

FaaS Providers: The Top Names on the Market

Top DevOps tools for organization

Tutorial(My experiences)-1-(Dynamic Programming)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Daniele Quero, PhD

Daniele Quero, PhD

A professional developer with passion for game developing and skill-growing. A former Nuclear Physics Researcher who changed his life to pursue his dreams

More from Medium

Unity Animator Override Controller — Another Tool to Improve Animator Functionalities

Did you just hit me! — Hitbox attack system in Unity2D

Journal 146 — Unity Project Development, 2.5D Shooter

Automate Player Input with Unity Test Runner and NSubstitute