In the scene I have pressure plate set and box set up. I will go over the logic on how to both push the box and respond to it when it arrives on the pressure plate. I already have a character created, which I created here.
The box we are pushing needs a rigid body and a collider attached. The collider will not be a trigger and the rigid body will use gravity and be frozen on the x, y and z angles.
The pressure pad has 2 parts. The parent object with a box collider (trigger) and the child…
In this article I will go over how to implement a wall jumping mechanic in your game in Unity. The basic jump mechanic has been step up in my previous article.
On your players script add a new vector 3 variable called _wallNormal, the surface normal of the wall is the point which is perpendicular to the surface of the wall. This is what we will use to “push” our character in the opposite direction to the wall.
We will also add a bool to determine if the player can double jump currently.
In this article I will go over how to create simple elevator system that requires pick ups before being able to be activated. It will be modular allowing more to be built on.
In my scene for the call button I have a small cube with a sphere on it. The sphere is coloured red and will change to green when successfully changed. Attached is a box collider trigger and rigid body. This is used to detect when the player can interact with the object.
The elevator can just be a simple 3d cube platform. I’ll replace this object and…
In this quick article I will go over how to create a moving platform in Unity.
Our moving platform will move between set targets continuously, we will create a visual representation of the targets as children when we create the platform. We will then write a script which unparents these targets from out platform(otherwise they will continue to move with the parent and it will never reach its destination). We will then add the movement functionality to our script.
The first step is to create the platform. Create a 3d cube and call it “Moving_Platform”. Stretch it out a little…
In this quick article, following on from my previous one, I will go over how to add a double jump mechanic to your game.
The first step is to create a bool to check if the player has double jumped.
In our script we will change the jumping function. We will remove the “if grounded” check first. We then will exit the function (using return) if the player has already double jumped. We then check if the player is currently jumping and if so we set the “has double jumped” bool to true. …
In this article I will go over how to create a simple physics based character controller which will be used for a 2.5d platformer.
I have created a simple scene for what could be a 2.5D platformer. I have added some primitive cubes as platforms and a 3d capsule for our player.
First step is to add a character controller onto your player, ensuring the collider matches the dimensions of your game object.
Next lets create our Input controls. In the project view right click or press the plus button and select “Input Actions”. This will create a new input…
In this quick article I will go over how to create a loading bar in Unity.
I have a main menu scene built , with a background, title image and two buttons (start and quit). It will be the start button loads our loading screen scene (which is the scene in between the many and main game scenes).
On the loading screen I have created a simple script which calls the coroutine LoadingBarRoutine”. The coroutine changes has as variable assigned to the loading progress of the scene. We use the method LoadSceneAsync to achieve this. …
In this article, I will go over a quick and simple method of implementing a security camera system in Unity.
A developer sometimes gets tunnel vision and will code in a solution to a problem when there was a simpler way. Case and point when I was tasked to create a moving security camera the first thing I did was write a script to manipulate the game objects rotation over time. There was a more simplistic approach. Animation.
The first step is to create and add an animation controller for your camera and adding it to the game object.
In this quick article I am going to go over a simple collider sight system for AI sight.
The first step is to create the object that we will use as our field of vision, for this I have created a cube and attached it to my guard, ensuring the cubes collider is a trigger.
Next step is to create a sight script. On this script add we are going to add an on trigger enter and on trigger stay method. The on trigger enter function will check if the collision is with a player and if so, assign to…
In this quick guide I will cover how to make a modular waypoint system for your AI.
The first step we take is to create a new script for the AI. I called by GuardAI.
I have made a list of transforms which we will assign in the inspector so we can attach as many or as little way points as possible.
Our script is modular and will allow guards to have 0 or unlimited way points to move through. …
Unity developer with a love of learning all things programming.