This week, decided to get back to work with the Camera, I had already a basic implementation.
The player was able to rotate the camera around and some basic collision detection was implemented: a raycast thrown from the player to the camera, if a collision is detected the camera moves a bit ahead of the collision point.
This would suffice for most of the situations, but there are some exceptions on which the player would benefit for something a bit more sophisticated.
Exception 1 – Small, thin or full of holes objects
Sometimes, if the main characters passes by one of those really close and this object happens to be between the cam and the character, then, the camera will quickly/abruptly move closer to the character. This can be a bit disorienting for the player, and, honestly there is no real need to move the camera closer, the geometry of these objects won’t prevent the player from “guessing” what is behind.
For this exception, first, I changed the player shader to display the silhouette. when an object is occluding it, on top of it. Then, I tagged these specific objects so they are not retrieved in the raycast collision.
As a result, in the supposed scenario above, the camera won’t move, but the player could still follow the trajectory.
Exception 2 – fixed camera
Sometimes there some specific angles that are really beneficial for the player, you can always let the player find that specific angle themselves, but in most cases they would appreciate a little bit of help :).
So I have set up some volume bounding boxes connected to a fixed point in space, when the player enters that volume, the camera moves as close as possible to that fixed point, and stays there until the player leaves the volume.
Exception 3 – Camera on rails
Similar to the previous one, the difference here is that I can make the fixed point “mimic” the movements on whatever axis I decide, one, two of all of them at the same time.
This somehow imitates camera on rails feature, widely seen on movies.
Exception 4 – Cinematic
Haven’t done much here, just integrated the cutscene plugging uSequencer.
IA – Back to back
Last, some basic IA, after a couple of seconds, if there is no input received the camera will automatically move to the back of the player.
Finally, you can watch a video with all those features implemented:
Hope you find it interesting!