Skip to content

Prevent internal edge collisions without heuristics #40

Closed
@hexus

Description

@hexus

The heuristics are pretty painful now, when it comes to maintainability and reliability. It's time to use SAT.js more wisely.

This is part of the 0.3.0 roadmap, and the item looks like this:

  • Custom SAT.js implementation that can prevent internal edge collisions (like this)

http://www.wildbunny.co.uk/blog/2012/10/31/2d-polygonal-collision-detection-and-internal-edges/comment-page-1/#comment-1978

The discussion here proposes ignoring collisions that occur with internal edges, which is a nice solution, and in fact what the heuristics do already.

After some experimentation in the ignormals branch (hah) at the same time as tinkering with SAT.js, this turns out to work exactly the same way, except it resurfaces the issue with skipped collisions for small and fast projects between tile seams (#38).

The direction I want to take this is using SAT.js to first determine if there is any collision, and instead of using the shortest separation that it gives back, use the shortest separation that isn't an ignored axis, which are indeed now flagged as part of each tile's polygon edge normals.

I tried to do this by just skipping flagged normals in SAT.js to let it fall back to the smallest non-ignored normal, but the results were identical, which means either:

  • SAT.js has trouble with tiny polygons
  • SAT.js is doing something that I'm not aware of
  • My understanding of SAT.js or SAT is... flawed

This can probably be achieved outside of SAT.js with a custom testPolygonPolygon() function.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions