Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player is pulled up/aside when dealing with one-way platforms #2

Open
passiomatic opened this issue Apr 20, 2021 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@passiomatic
Copy link
Owner

passiomatic commented Apr 20, 2021

This is due to the way I'm implementing the check to block (or not) the player while it jumps on a one-way platform from below.

Here (https://github.com/passiomatic/sunny-land/blob/main/src/Physics.elm#L284) I'm projecting the player velocity along the wall normal and see if they have the same direction. If this is the case the player is coming from behind/below the wall and the game doesn't block him.

This is a simple check and works well, but it has one quirk: if the player doesn't jump high enough to reach the platform he ends up halfway and the moment the velocity starts inverting its direction (because of gravity) a collision is generated and an impulse is calculated "fixing" his position abruptly.

Fix: use code from https://github.com/passiomatic/platformer-physics

@passiomatic passiomatic added the bug Something isn't working label Apr 20, 2021
@passiomatic passiomatic self-assigned this Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant