Game Feel Improvement
A few weeks ago, I wrote a post here about game feel issues in the game, specifically the movement of rotating onto different surfaces.
At the time I was trying to use a system of procedurally placing invisible quarter pipes in front of the player and letting the player walk up that in order to change surfaces.
I got it so that the quarter pipe would line up right against the wall, and move along side to side with the player.
Despite this, the system didn’t end up working very well. It was too unpredictable as to where the player walked to, and involved to many sub-cases. The quarter pipe worked best when it was 4 units high and 4 units deep. This meant that any wall shorter than 4 units would need a smaller quarter pipe. However, smaller quarter pipes just didn’t feel as good.
There was also the issue of the tail end of the quarter pipe catching the player as the player walked off of it, and messing up movement. Corners also didn’t work very well, as there were 3 different surface normals all within really close range of one another, and the quarterpipe placement would occasionally overlap with the player.
I decided to go with the previous system of rotating the player rigidbody object through code, and just improving that.
However, making with the quarterpipe system was not at all a waste of time, as it allowed me to get a feel for what a more “natural” rotation movement would feel like, and served as a good reference point when improving the other rotation system.
Issues with Old Rotation System
After studying the old rotation system a bit, I realized that there were three reasons why it felt clunky:
Problem #1: When the player rotated onto a wall, they snapped to be facing straight regardless of original angle of approach - this is probably best explained with a visual. Look at the gif below – the red line shows which way the character is facing. Notice how it doesn’t matter the angle with which the player is facing the wall before rotation. After rotation, the red line is always aligned with the axis. It’s especially noticeable in the gif when the player rotates from the orange surface to the blue surface.
I actually hadn’t noticed all throughout development until I started to pay attention. What happens during gameplay though, is that you end up having to keep readjusting the angle you’re facing, which contributes to the clunkiness.
2) The player’s speed drops to 0 after rotation, even if they were holding the forward button – Again, a very slight effect, but contributes greatly to clunkiness. It’s like coming to a red light at every intersection. The player is constantly stopping and going, instead of being in a flow state. The problem here was that I was making the player rigidbody kinematic during rotation, and then disabling it again after, so that the physics force pushing the player forward had to be reapplied.
I’m not sure why I implemented the temporary kinematic thing.
3) The rotation speed doesn’t take into account the player’s speed when enter rotation. - It didn’t matter if you were running at a wall, or standing still next to it, if you hit the rotate button, the speed ends up being the same.
Improvements to Rotation System
1) Player can now rotate onto wall, and the angle with which they were facing the wall is maintained - This was pretty tricky to implement. Mostly it involved using a lot of quarternions and raycasts. A basic run down: first figure out the difference in angle between the player’s actual rotation and what the rotation of the player would be if they were directly facing the wall. This is done using the surface normal of the wall (gotten from a raycast). Then, create a quaternion based on the angle difference, and apply that to the quaternion of what the player would be after they switch walls.
Anyway, here you can see it working:
2) Player doesn’t stop after rotation, if they continued pressing forward the whole time – pretty straightforward technical fix. I just didn’t set player to be kinematic during rotation.
3) Rotation now takes into account the speed with which player approaches the wall – if you rotate from standing, the rotation will be much slower than if you rotated when approaching the wall at full speed.
As you can see, it takes into account the initial speed, and also makes it slightly faster during the middle of the rotation.
I’ve added a slight head bobbing effect when you’re walking. Don’t worry, you can disable it if you want to.
The more important effect is a more noticeable bob that happens when you land after a long fall. The landing always bothered me before, because the player would just stop immediately.
I’ve added an effect so that the head will bob up and down once after you land, and it makes landing feel like it has actual impact.
Sorry for the potato quality – it’s a gif made from a vine recorded of my monitor (too busy to actually screenrecord it properly).