Adding colliders to a scene

GameDev Dustin
5 min readFeb 8, 2022

If you don’t want your players falling off the map, you’re going to need colliders.

Floor Colliders

Having floor colliders is probably the most important.
Without them your player will simply fall down forever.

Now, your game may have terrain to handle collision, but you will still need floor colliders for buildings that are taller than one story.

We want to position our floor colliders as close to the appropriate height as possible.

Once we have our primitive boxes sized and placed as we like, we need to toggle off the Mesh Renderer component on them.

Wall Colliders

Similar to floor colliders, we need to define the horizontal boundaries so that players don’t, you guessed it, run off the map…and fall forever.

We want to position our cube primitives as close as possible to our visual walls’ locations.

A quick tip to save time, most rooms have symmetrical aspects to them.

As shown above, you can simply duplicate an existing wall and position it the new wall to save time.
Never start from scratch if you don’t have to!

Don’t forget to leave space for your doorways or your players will be trapped inside the room!

We want to make sure that our walls cover the door frames but not the doors.
The player shouldn’t “pop through” the door frame.

Don’t forget to add a collider to the door object itself so that it will act as a wall when in position but once moved will create an opening the player can walk through.

Ceiling Colliders

If your game gives the player the ability to actually reach the ceilings, you’ll need ceiling colliders.
If not, you can generally get away with not adding them.

Still, when in doubt you should probably go ahead and do it.

Since you’ve already done the floors, it is very easy to add ceilings.
Simply duplicate the floors and raise them to the appropriate ceiling height.

Columns, Beams, and Structural elements

We also want to make sure we put colliders on all of our columns, beams, joists, etc.
Anything structural to a building will likely need a collider.

Stairs and Platforms

You can’t walk up stairs without colliders.

We also need to make sure we add colliders to any raised floor levels such as the platform area we have in our scene.

Even though these colliders look properly placed, the Unity first person character controller I tested the scene with would not climb them.

So I created a duplicate game object, unpacked it, renamed it Scifi_Stair_01A, and made the colliders work as a ramp.

Miscellaneous Objects

Anything the player can run into, but not through, needs a collider!

That includes all decorative elements such as furniture and other static scene elements.

For objects with more complex geometry, we make use of compound colliders.

Above the desk uses different size box colliders, but we with the tank game object we use a capsule collider and a box collider to get a more accurate collision.

Sometimes game objects you might think you’d need to create a compound collider for can get away with a primitive collider.

If your game really needed more fidelity than this, you would create a compound collider but for what I’m doing a simple box collider works on the power core shown above.

Test it out!

Unity has a free character controller asset for both third and first person we can use to test out our scene.

Download whichever one you prefer from the unity store and import it into your project with the package manager.

Hit play and enjoy!

--

--