Recently, more progress was made on player movement. Some clips of this motion can be seen in previous posts, but we’ll take a closer look in this short post.
Previously, the player character was a lot simpler. If you moved in a direction, the character would instantly rotate to that direction and immediately move in that direction at the desired speed.
Acceleration was added to the player movement so that the character didn’t instantaneously switch speeds. Easing between rotations was also added so that the character didn’t instantaneously switch from one rotation to another. Velocity and rotation were also linked together now. The rotation would change depending on the player’s input and then a speed would be applied in whatever direction the player was currently facing.
More recently, the character rotation and velocity became even more intertwined. If the player moves forward, left, or right within 70 degrees of where the player is currently facing, the character will simply rotate in that direction and keep a steady speed in that same direction (same as before). However, if the change in rotation exceeds 70 degrees, the character will keep their current rotation, decrease speed to a halt, rotate the character to be closer to the desired angle, and then increase speed to the desired amount. This gives the character a slightly more realistic and grounded motion while walking/running around.
There’s also different speeds at which the player will rotate during a large angle change vs a small angle change depending on the current player state (e.g. walking, running, crawling, jumping). It won’t feel as tight as player control you’d see in a platformer, but that wouldn’t ultimately fit with the type of game we’re trying to make. We’re moreso inspired by games like Ico and The Last Guardian – games with loose physics-based movement.