Since the last updated, I have mainly focused on a terrain mesh and updates on the camera features.
For the terrain mesh, I've been using the unity default terrain feature.
You can get decent results quick and it is integrated in the editor, so you can modify it and see the results in real time.
But it also has limitations, for me the most annoying ones for me were:
The chequered layout: the terrain is a heightmap defined by the resolution, disposition of these points that define the terrain cannot be moved, so you are limited to this chequered mesh. This became really noticeable for me when I tried to make some roads on the terrain.
Textures on perpendicular surfaces: with the default unity terrain tools you cannot modify the uv coordinates of the texture, this becomes really annoying the more perpendicular the surface is as it will be displayed more and more stretched.
Holes: well, you cannot make any holes on the map, that’s it
So, after trying for a while to find fixes for all those limitations, just gave up, exported the terrain into an .obj file, and worked on a brand new terrain on blender. You can do all you can think of, but it is way more time consuming, and you cannot see the results in game in real time, so I had to go back and forth multiple times.
After a few days, I managed to put something decent together, and I’m quite happy with it
Then, as mentioned above, I spent some time working on some new camera features.
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 objectsSometimes, 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 cameraSometimes 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 railsSimilar 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 – CinematicHaven’t done much here, just integrated the cutscene plugging uSequencer.
AI – Back to backLast, some basic AI, 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!