Skip to content

Sweeping and linecasting #11

@paperjack93

Description

@paperjack93

Hello,
I am using your collisions system for my game and, with some adaptation (converting it to module.exports - I couldn't get the import thing to work on node.js), it's working pretty well.
I have some questions however:

  1. Is the correct method for raycasting to create a 2 point polygon and checking its potentials? I haven't encountered issues, but there might be corner cases I don't know about.

  2. Sweeping items. Some items in my game will move pretty fast (ex. bullets) and I couldn't find a logic that handles this, therefore I think implementing pre-movement sweeping is necessary.
    I was wondering if it's a good approach to create a rectangle polygon with the widest points of the body being sweeped and a copy of the polygon at the target point. Then I check all the potentials for both, sorting them based on their distance from the original body. And for last, I use the x y overlap of the rectangle polygon (or the negative x y overlap if its closer to the original body than the middle of the rectangle of the body) as a point to move the original body to.

Thank you very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions