Stilla Natt is a third person game puzzle/exploration game with horror elements inspired by Resident Evil that I helped create at TGA during 14 weeks at 50%.
Camera controls and collisions
The camera is controlled by moving the camera to the players position and the rotated with the mouse delta. An adjustable offset in height/width and length is then apply to set a correct distance from the player.
The first iteration of camera collision worked by shooting a ray from
the players position. If the ray returns a distance shorter than the distance between camera and player we set the distance offset to this value. At the same time the Camera controller system continuously tries to return the camera to its original distance offset.
The issues with this approach is that if the player stands parallel to a wall the camera will see through the wall and the continuously trying to return to the base distance offset will occasionally fight with the teleport to ray hit position function causing the camera to jitter back and forth.
I rewrote the system to instead shoot several rays from the cameras position. One infront to check for objects between the player and camera. One behind to handle the player backing into a wall and to the sides to handle the user walking sideways into walls or sliding the camera against them. Any of these collisions will activate a camera translation forward and if more then one collision appears they will accumulate to speed up the zoom in.
The system also checks the delta input of the mouse to decide when the correct positions i.e if the player is not moving the camera while its close to a wall nothing will happen. During movement the speed will be reduced to avoid clipping and give the camera time to adjust. This works well for a slow paced game like Stilla Natt.
I also added a camera bob functionality to the camera which can be synced up to footstep sounds and a system to switch between different camera presets for game testing.
The menu system is pretty barebones. Position/scale on elements are read in through json aswell as the relevant path to the sprites that were used for a menu element. Buttons hold a lamda to handle functionality and a simple state stack was implemented to take care of switching between different submenus and the pause menu