Player movements with collision resolution, friction, time dependency and more

Demo: https://bytezeroseven.github.io/Player-movements/
Source: https://github.com/bytezeroseven/Player-movements

4 Likes

Nice !

I would reduce a bit the tweening of the camera movements because it’s a bit frustrating to have to wait for it to be where we asked it to be 2 seconds ago. Also the jump is very floaty, it feels like an underwater level at the moment.

Also QWERTY keyboard is not an international standard, with my French keyboard it doesn’t work, I had to emulate a QWERTY keyboard. The fix is to use the code parameter of the key event, instead of the key parameter. code is consistent across keyboard layouts. More about this here : KeyboardEvent.code - Référence Web API | MDN

Good job :+1: Are you working on a game ?

Wow really great! Thanks for sharing this! Great work!

Nice. I would mention that this looks pretty good for moving a brick, but if you want a “character” controller, you usually don’t want so much of physics in there. You want the character to stop when you let go of the key, you want some air-control.

Personally, my experience with writing character controllers is quite limited, but I found that “real” physics just feel bad when controlling a character. It may be a different story if you have some physics-based game, where all that stuff is part of the essential gameplay experience.

1 Like

I understand how physics can be overkill in many situations or not be the right choice for feel of movement. But I did want to say I really like the feel of the controls right away. So much so that even though you have not built a game, I felt the need to get the cube to the very top. And it was a lot of fun…

This character controller might not be right for every game, but using does inspire game ideas that do fit the feel.

Thanks again for sharing!

1 Like