This week, I set about starting to prototype a 3D character controller, as this would be the mode of perspective I would like to eventually use in my project, Gale. I first combined a simple square head that would act as the "face" to show where the player was looking with the capsule collider, as a placeholder model for the player. I then set about using GDScript (Godot's built in programming language) to create the logic for input and movement. Unlike Unity, which comes with preset character controller types you can import into your projects, there are no such pre-made assets for Godot, so I had to create all of the movement and cameras on my own. I referred to two tutorials (listed below) as well as Godot's documentation to create my system. This took a lot of tweaking as, reportedly, some of the 3D movement and collision functions are not currently working as intended in some edge cases (stopping on slopes). I also spent a great deal of time trying to get the camera to follow any target, however ended up simply making the camera a child of the player to make the transformations easier. I also made the player character turn to face the correct direction when the mouse moves by setting up tracked "pivot" points.
After the video was taken, which displays a bug where the player slides down/does not stop on hills, I did manage to resolve this bug. Furthermore, although the "jumping" behaviour unexpectedly operated more like "flying" behaviour, I ended up quite enjoying the flying mechanic when moving through the animal. Furthermore, since my future prototype will likely involve a lot of wind mechanics/flying, I decided it was something I could further iterate on, instead of fixing it to be a conventional jumping mechanic.
Although this was a lot more time-consuming then it would have been in Unity, I learned a lot about vectors and transformations in a 3D space by coding the movement myself, and in addition, through my experimentation with buggy "jumping" I was able to explore the mechanic of flying.
By Natasha Vranic-Peters
Email Natasha Vranic-Peters
Published On: 08/04/2020