How to Fix my Character Controller #984
-
Hi, I recently built a project in isolation from my game, I want to use this project to make the character controller feel right. As of right now I am using a As you can see there are various unwanted things that occur with the pure
Do I have any issues with my code which are causing these problems? Here are the relevant files:
The version of this project where the jolt-godot plugin is used feels extremely good out of the box and doesn't have many glaring issues in comparsion. I looked at the godot-jolt and couldn't find any relevant info about a character controller. From what I understand, godot will use their own character controller logic defined here which just sits atop jolt. If these issues are not related to my code, then maybe there's things to learn from the godot implementation? I'd be willing to help contribute if improvements to the character controller (virtual) are in scope. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
For an example please look at the CharacterVirtual demo: JoltPhysics/Samples/Tests/Character/CharacterVirtualTest.cpp Lines 37 to 160 in de3517e If you have specific issues, please modify this test to show the problem. |
Beta Was this translation helpful? Give feedback.
-
Hello, The problem with your solution is that you never reset the vertical velocity of the character (unless you jump). If you add:
at the end of You'll see that moving into this ramp results in a tiny bit of movement towards the ramp and a very large movement towards the floor. So you'll slide down the ramp rather than up. This is why the example separates the velocity in a horizontal and a vertical velocity and resets the vertical velocity when you're moving into the floor. |
Beta Was this translation helpful? Give feedback.
Hello,
The problem with your solution is that you never reset the vertical velocity of the character (unless you jump). If you add:
at the end of
CharacterVirtualTest::HandleInput
you'll see that theupdated_velocity
vector is ever increasing. If we for example go to the ramp:You'll see that moving into this ramp results in a tiny bit of movement towards the ramp and a very large movement towards the floor. So you'll slide down the ramp rather than up.
This is why the example separates the velocity in a horizontal and a vertical velocity and resets the vertical veloci…