Update 04 - Player Controller

Published June 12, 2021
Advertisement

Rigidbody Player Controller

Since my last update, I continued on working on the game, mainly the player controller because that is one of the things you, the player, will be interacting with and I want the movement to feel smooth without any weird issues popping up, like being able to walk up steep slopes. I originally used Unity's Character Controller because it handled all of the “physics” for me allowing me to create a player that moved. After a while though, its limitations started showing, which caused me to create ugly workarounds that shouldn't be used. After a while, I did decide to move on to Unity's Rigidbody component, which allowed me to have more controller over the physics of the player, and over the last 2 days, I worked on making the controller work, since there was a few issues I had to tackle, like detecting the ground and some friction issues. I worked on fixing these issues and looking online for any solutions, which did help me fix those issues. At this point, the controller is working almost as intended with a few hiccups here and there, nothing I cannot fix.

Why Rigidbody over Character Controller

I stated above that the Character Controller had limitations that caused me to use ugly workarounds. The first major limitation is attempting to set the position. Unity's Character Controller automatically sets the position to the last saved position, which means, during runtime, the controller can only be moved by either using the Move or SimpleMove methods or by disabling the controller and moving the position manually. This would be fine if it was for some smaller issues, but for me, it proved to be an ugly use of code. When the player crouches, I'm resizing the actual collider's height and when I try to resize it back to the standing height, the controller will start to get stuck in the ground, causing the view to become jittery. So with that, I would disable the controller and move the player's y value up by a set amount every frame so the resizing of the collider does not cause any glitches with the ground. Another issue is the lack of actual physics. In most fps games, if you jump up and hit a ceiling or a low hanging object, you expect the player to instantly fall back to the ground. The controller does not follow that logic. What happens is if the player hits an object above it, the controller will keep trying to move up, which causes the player to get stuck in the air for a second before falling. All of these issues have been solved when I switched over to a Rigidbody

What to expect

Now that I got the first main part of the coding done (Player Controller), I will slowly move towards getting enemies setup with some basic logic to start, allowing me to create all of the components needed. This includes a class that deals with the player's health and shield. I already have that part down, but as time goes on, I expect those classes to grow as I require more functionality from my code. When it comes to stuff like art, I'm far behind because I'm both looking for someone to help make 3D models for the project and working on the coding, which leaves me less time to work on the art without fully abandoning my code.

This update does seem slow again, but over the next month or two, there should be major improvements to the project along with a final vision for the project. Until then, thank you all for reading and I will talk to you next time

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement