Week 37: It digs!

This took me so long to actually get working I can’t believe it’s finally done. I had to do so much complex trigonometry and math that I don’t think I ever want to do it again. But at least the effort was worth it and digging now fully works.

As mentioned at the start of this blog, the main movement gimmick I wanted to add to the game was burrowing underground and allowing players to move alongside walls. While the burrowing was fairly easy (mostly just a model replacement) it was the moving on walls that gave me a lot of trouble.

What I had not considered while doing this is that I would need to rotate my entire character to make this viable. While rotating itself is fairly easy, problems started coming along once the character was vertical on a wall. For example, the previously mentioned movement vector would not rotate with the character, which essentially meant that once he was vertical and horizontal movement needed to be replaced by vertical movement that was just not happening.

I also needed to make this as easy to understand for the player, which meant that the direction the character needed to move in needed to be in reference not only to the position of the camera, but also to where the character was on the wall.

I tried fixing these problems for weeks, I almost gave up about 10 times but in the end I managed to figure it out. I had to rewrite some of my code but now all Vectorial rotations are handled by an invisible object that rotates depending on whatever ground is under the character’s feet. If this sounds simple it’s most likely because it actually was and I was originally having so many problems because I was trying to solve this in a very roundabout way.

Anyways, here’s an example of wall digging and transfering from wall to wall.