Closed hexus closed 2 years ago
This change knowingly leaves issues at junctions where slope angles change:
Bodies can get caught at these junctions at slow velocities or at very unfortunate angles.
Fixing this would involve comparing the change in slope between neighbours is within a particular threshold, rather than just checking whether they're the same (which is what this fix does).
The true solution for this problem as a whole is handled properly by hexus/phaser-slopes in Matter.js for Phaser 3, which ported Box2D's algorithm that solves this problem for arbitrary neighbouring polygons using ghost vertices.
It could be ported to this plugin with a fair bit of work, but Phaser 2 isn't where I want to spend time supporting things. PRs would be welcome for a change like this.
The heuristic algorithm in
TileSlopeFactory.flagIgnormals()
was a little too sweeping in its judgements, causing issues like those presented in #55, which demonstrates some more intricate and admittedly untested tile configurations.This change refines the assumptions made by that method, particularly by comparing neighbouring tile slope angles for a match, and whether slope lines of neighbouring tiles meet properly (whether the end of the current tile's slope line matches the end of its neighbour's slope line).
It also fixes up the slope line definitions for a few tile types where they were inaccurate, as well as adding debug rendering for them.
The change also updates the license's end year from 2018 to 2021.