Top-down camera for a driving game

Hello, I am developing a driving game with the camera following the car like in the GTA Chinatown game; where if you steer to the left, the camera is also rotating to the left.

I have successfully done that. Currently, the camera is centering on the car.

However, I want to make it so that the camera placed further to the front of the car so that the player can see the road ahead; while also keeping the car in frame, just down further.

Doing this with Camera Y Position messes up the camera position obviously when steering the car. So I have no idea what to do. Any kind of suggestions would be greatly appreciated.

Hi,

You’d need to create an additional point inside the car sprite, that is placed in front of the car at the distance where you’d want the camera to be.
Then place the camera on that point’s coordinates instead of the cars position coordinates.

If you use a camera movement extension that follows an object, then you’d need to create a helper object that you place on the created point coordinates, hide the helper object, and then make the camera follow the helper object instead of the car.

Since the helper object is in front of the car even when it rotates, then the camera will always be placed where you want it to be.

Another way to do this is to have an object that the camera focuses on, and use the Sticky extension to position it in front of the car object. The Sticky behaviour will ensure the camera focus object stays in the correct position relative tot he car sprite all the time.

The bonus of doing it this way is you can move the camera focus object without having to change the camera events. So say you want it to focus on another car, or the player (if they get out of the car), then you just stick the camera focus object to the object you want the camera to follow.

2 Likes