On the Unity asset store, there are many templates that I can buy to save me time on common mechanics. Like a third person controller or a inventory system. Now to save myself time in my game, I could buy one of those and probably trade money for time. However, if I do that I wouldn't be learning anything would I? Those asset's often say "so you don't have to reinvent the wheel" but how am I suppose to learn how the wheel works if I don't know how to reinvent it? That's a much simpler metaphor to a much more complicated game mechanic. This week I'm working on how to make a good third person controller, so without further ado...
Now that I had the basics of the camera working I needed to get my character moving. What I did was make a script that figured out when the player wanted to move, how they were moving and where they were moving. I made this little flow chart which had many functions in each step, but this shows the gist of it. I also add prayers to some of my scripts when I can, I'm a Christian but don't let that offend you. (bottom left) First it checks if the player is moving. Then it checks if they're wanting to run or walk. The green part is to prevent switching from running to walking (or vice versa) in mid air. Lastly, for the most basic third-person camera system that I made, I simply needed to integrate jumping. It was an entirely different script that ran at the same time as the movement one except it prevented double jumping and didn't change the way the player moved around the ground. (top right) After all that shenanigans, I could put it together to make my basic third person controller (see gif above). The player can now walk, run and jump! I'm planning much more complex actions in the future, but this is a good start for now. I'm super tired writing this and have to get to bed. For next week I'm going to try and implement a little more third person controls as well as well as maybe some interaction options. But until then, stay classy!
Comments are closed.
|
William EngelHi, I'm William and I'm a Game Developer with the classic vision of a game that's going to change the world. Categories
All
|