▲ Watch the devlog on YouTube ▲
Hello everyone and welcome back to my devlog!
On Monday,
I kicked things off in a new project and began working on the input controller, as I had to deal with swipe gestures and the accelerometer.
Next, I went into the player controller, and began working on player movement. The idea is that lateral movement is moving left and right, and longitudinal movement is moving forwards and backwards. Lateral movement however brings its own set of problems, as the player has to rotate around a pivot point at the center of each level. At the beginning, when player 1 and 2 are at the same lateral position on the circle however are different distances from the center. When both players are rotated at an equal angle, it is clear that the arc-lengths at which both of them travel are different. And so I have to account for the fact that as the player's radius increases, their angular velocity must decrease in order to maintain a constant linear velocity. I achieved that using the following formula where W is the angular velocity V the linear velocity, R the radius and Theta the angle at which the player must be rotated.
On Tuesday,
I created the camera controller script, where it lerps to different positions based on whether the player is crouching or aiming. I then went on to create a speed system where the maximum speed changes based on whether you're crouching or aiming and walking or sprinting.
Next up was jumping. I wasn't using a rigidbody at the time so I had to implement my own system for gravity. Don't worry I do use rigid bodies in the end, but it was all a process... The reason was because I was using a transform system to move the player... however that would mean I would have to use a kinematic rigid body which will ignore collisions and so that's what I ended up working on next I implemented the system where I'd use ray casting to determine whether objects in front of the player were immovable or not. (Again, I changed all of this later on).
On Wednesday,
I figured that the movement system I currently had in place was not the way I wanted to go, as I wanted use rigid bodies in order to make use of Unity’s physics system for gravity and collisions.
After quite a bit of time I ended up figuring out how to achieve this without making the player a child of the center, however I found a post online that made me completely rethink what I was doing and I went back to my old movement system. After a bit of bug fixing I was happy with the movement system, as all the physics with regards to the collisions and gravity were working just fine. Next on my to-do list was dashing or rolling, where the player will be able to dash left or right and roll forwards.
On Thursday,
I went to http://mixamo.com and downloaded a couple of placeholder character and animations to work with.
I then went on to Unity and created a blend-tree for all the animations to work together.
After I've finished, there where still a few issues with the sliding and so I had to tweak the animation speeds. I was happy with movement so I moved on to jumping. Next of the animations I wanted to implement today was aiming, and for this I needed to create an avatar mask that would control only the upper body. After a couple off funny issues, I finally got it working, but it wasn't quite right... The play would sway when moving and aiming and when crouching the player would completely deform. I thought this might have been an issue because I was using the generic animation rig instead of the humanoid one, so I tried switching over. Unfortunately it wasn't as simple as I had hoped…
On Friday,
after looking at every single unity forum thread, I finally figured out what the issue was. I had to unassign the avatar mask that was being created from the models animation and reassign the avatar mask from the player’s character model. After doing this everything worked out just fine… yeah I'm just kidding... I was now using the humanoid animation rig instead of the generic one, however I was still getting that annoying sway issue... After looking through a couple more Unity forums threads, I finally figured out that it was because I had not baked the rotations of my animations. For the rest of the day, I just worked on a placeholder crater model, and even though it was probably the worst model I've ever seen in my life, after importing it into Unity, it actually gave the effect I was looking for…
So that is where I currently am at this stage of development. I hope you enjoyed this post, and if you have any suggestions please feel free to leave a comment below!