top of page

First person Controller

As mentioned previously this project was done to find a solution to a problem when using rigidbody for character movement. 

​

In previous projects and school assignments, I was using rigidbody for the player's movement which caused a number of issues such as:

​

- When going up a slope or down a slope the player tend to fly off the slope due to the nature of rigidbody having mass. Hence having momentum/inertia to make the player fly off a slope similar to how a car can fly if it was to go very fast up 

​

- When the player let go of the movement keys, the player will move forward slightly more due to the same issue where the rigidbody having mass. Making it difficult in situations where the player needs good control over their movement such as in a platformer game. 

​

​

​

After researching, I came across something called the character controller which solves the issue mentioned above but requires the programmer to program their own physics. I also have no experience working with a character controller and it was not mentioned nor covered in school lectures. Hence the reason why I have decided to start on this mini project.

​

While doing so I have decided to also make a few simple game mechanics from a FPS game called "Overwatch" 

​

​

This project consists of 4 different components. 

​

- Player movement ( using character controller )

- shooting

- 'blink' ability

- 'recall' ability

- ultimate ability

​

​

​

 

 

Player Movement

The making of the player movement was easier than expected. However there were things that I had to take note of. 

​

Previously, while using rigidbody, the unity engine have gravity handled by the rigidbody itself. However this was not the case for character controller. Because of that, I had to code in the gravity myself.

​

To do that, I have to check if the player was 'grounded' meaning if the player is currently standing on the ground and not jumping or falling. This is because gravity will cause the player to cause the player to drop at a increasing speed, but the speed of falling should not increase if the player is already on the floor. (checking for grounded is done via a raycast to the ground)

​

Hence I have coded my gravity in a way that there is a constant force pushing the player downwards when grounded, this is to prevent the player from floating when going down a slope and then suddenly dropping ( due to how the ground check is done ).

Only when the player is not grounded, only then the speed of him being pulled down is increased.  

 

Shooting

While I have done shooting via raycast before, I have not tried making a shooting script that allows the player to control the spread of the shots. I also took this chance to make a general, modular shooting script that can be brought over to future FPS game which allows the designer to control variables such as max ammo, shooting speed, spread and such.

 

© 2016 by Tomoaki Itabashi. Proudly created with Wix.com

  • LinkedIn Clean Grey
bottom of page