Skip to content

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

Description

@passiomatic

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions