uni

A Guild to Beautiful Games

Adding In Colliders to our environment

Now that our scene has been somewhat completed, it is time to add in our colliders for the walls and other static objects. There are several methods in adding in colliders, but the since the scene is already filled with complex shapes and textures, its best practice to lessen the load on the processing power, therefore when adding in colliders the more simple it is, the better.

Floor and Wall Colliders:

The general rule for making colliders is that, unless you want things to bounce off the ceiling, the roof shouldn’t have any colliders. As for the walls and floor, I created a new 3D cube and flatten the the shape into a plane, this cube would be stretched across all walkable platforms (except for stairs).

As for the walls I basically took the floor collider and duplicated it, then flipped so it is parallel to the walls and slowly build my way around the walls, with each side getting their own collider. The only wall which will need to be concerned about is the main front doorway where you want to avoid adding a wall collider blocking the door.

You want to nudge the wall colliders as close to the doorway as possible, without blocking it.

Column Colliders:

As for the column colliders, since they stick outside the wall colliders they might result in a weird effect if the players make contact with them. Therefore we will need to add another collider for each column, lucky since each column is an prefab all we need to do is add one cube with a box collider and the rest should automatically gain the same.

Start by entering the isolation mode, where you click the > on the hierarchy. Then we can manually add in a new 3D cube and adjust the size so it match in both height and width of the column, the more it covers the closer the collider is going to be when matching to the actual column. Finally we can turn off the mesh renderer of the cube to present a transparent collider!

We can apply the same process to the archway in the main hall.

Once that is all completed we are going to create a new folder in the hierarchy to house every single wall and floor collider (excluding the columns since they themselves belong within their own prefabs). Then we can turn off all the Mesh Renderers to make all the colliders transparent.

Once you are completed it is time to test our colliders to see if they are exactly how to want them to be.

Testing our Colliders:

To test our colliders, we can download the free Unity Starter Asset pack “First Person Controller”

If you don’t have this asset pack you can find it in the Unity Asset store which is now all online. Once that has been added, you can find the actual files within the package manager. Search for “Starter Assets — First Person” and this should pop-up. Download and then import into your project.

Once that is completed, you are going to see a new tab on the top of Unity controls call “Tools”. Within it, you are going to see the Starter Assets which you can then reset the First Person Controller.

Two new objects are going to be created in the hierarchy and you will see a brand new capsule on the scene. The main camera is also going to be controlled by this new player object.

Once you hit the play button, you will see that you will have full control over the player. Now you can fully test out the walls and floor colliders to see if they are at the right position.

Tip: If you find that your character controller is falling through the floors, you can lift the player controller up a tad bit so all of the player colliders are above the floor colliders.

--

--

--

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

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

Recommended from Medium

AI -ML-DEEP LEARNING

Introduction to Python Programming: Part 1 — Variables and Base Data Types

Cloud Native solution for Targeted/Context-aware Notifications in QSRs using Beacons and GPS

Raspberry Pi Uncut eBook Bundle

Final Project: Sketches and Diagram

QRL Mainnet v2.0.1 is Released

Integrate Selenium with Jenkins

How to Use Terraform with GKE: a Step-by-Step Guide to Deploying Your First Cluster

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
Simon Truong

Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

More from Medium

A Guild to Beautiful Game

Guide to Making a Beautiful Game: How I Built a Principle Office = Finale!

My journey becoming a Unity game developer: Player movement setup for Galaxy Invaders game-pt.3

Starting To Feel Like A Real Game