Skip to content

How to Fix my Character Controller #984

Answered by jrouwe
cuppajoeman asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

The problem with your solution is that you never reset the vertical velocity of the character (unless you jump). If you add:

mDebugRenderer->DrawArrow(mCharacter->GetPosition(), mCharacter->GetPosition() + updated_velocity, Color::sRed, 0.01f);

at the end of CharacterVirtualTest::HandleInput you'll see that the updated_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…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
6 replies
@jrouwe
Comment options

@cuppajoeman
Comment options

@cuppajoeman
Comment options

@jrouwe
Comment options

@cuppajoeman
Comment options

Comment options

You must be logged in to vote
3 replies
@cuppajoeman
Comment options

@jrouwe
Comment options

@cuppajoeman
Comment options

Answer selected by cuppajoeman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants