Skip to content

Collision detection doesn't work for Anchors other than TopLeft #30

@kurtome

Description

@kurtome

CollisionDetectionBehavior.intersectsOther has math that assumes the x and y for each entity are all relative to the top-left corner, which is the default Anchor. So, if you change an entity Anchor.Center, the hitbox won't actually match up with the collision detection (it'll be off by half the width in this case).

This bug is currently visible in the examples/standard_platformer because the Coins are Anchor.Center, how the next PR will change them to use the default anchor to avoid this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions