New Game Development #2: Moving Camera and Collision

1 minute read

When continuing my game built in the unity engine I first wanted to accomplish two things after the movement was complete. These two objectives consisted of creating a camera that followed the car to not limit the map size and creating collision. Collision disables the ability for objects to go directly through each other therefore limiting the movement of the car through solid walls. First off making a moving camera was a simple script attached to the Main Camera in Unity. All that was needed to be done was move the camera on X and Y coordinates in real time corresponding to the player. As for collisions Unity has several built-in tools to assist with this. First of all Unity provides polygon collisions which create a barrier around an Object such as buildings, walls or the player. These boxes work when attributes are assigned to them such as a “Rigidbody” which consists of Mass, Friction and Bounce when reacting with other collision polygons. Overall I feel as is I have completed the mere basics of a car game, but my movement needs an advancement. Currently, my goal is to accomplish acceleration and deceleration as well as drifting. This would provide a more realistic and less fake and cartoon simulation of a vehicle.

A demo of the progress is shown below: