Our lecturer suggested that we think of two tasks to focus on and I planned to complete chunk generation along with a basic character controller to help test the chunk spawning dependent on player positioning.
I already had the foundations for generating multiple chunks which helped to decrease the workload to allow certain chunks to be active at a time.
I decided to use a 2D array as a grid which I was able to alter to allow only the mesh that the player was currently on (originally set to the very centre item in the array) and then set the eight neighbours around the current mesh as active as well which prevents the player from being able to walk right up to the edge of the mesh before the next one is available.
Player Movement
Despite wanting to leave extra features such as a player to the very end, I needed a way to test whether the chunk generation is working. I didn't need many controls so I set up player movement where the player can use the arrow keys or WASD to move the player in the direction they want to move. I also added a camera controller for a first-person view which allows 360 rotation and the ability to look up and down within a 120° angle.
As a final added little detail I added a line of code that will turn on Unity's built-in fog system.
The controls created were enough to test whether my generation was working and having chosen not to create a jump but instead use the momentum from running off a hill had a fun gameplay to the point of making me want to have this as part of the game and adding pickups for a point system. Lots are still in the planning to be added and fun features like a point system will have to wait until after I have more generations working, starting with object spawning.
コメント