box2d.ts
box2d.ts copied to clipboard
Differences to original box2d
While I'm trying to look for ways to compare the code to original box2d, I noticed a few places, where the logic is quite different (beyond typescript conversion) and I wonder if that is something you rewrote yourself or if that came from the liquidfun project.
For example b2FindMaxSeparation
differs a lot in implementation.
It looks like it's an older version of b2FindMaxSeparation; I must have missed that when porting one of the releases. Thanks for letting me know. Let me know if you find anything else.
Here's something that seems completely off:
Your b2AABB.Contains method:
if (lowerBound.x <= aabb.lowerBound.x) {
return false;
}
if (lowerBound.y <= aabb.lowerBound.y) {
return false;
}
if (aabb.upperBound.x <= upperBound.x) {
return false;
}
if (aabb.upperBound.y <= upperBound.y) {
return false;
}
return true;
Box2d Contains method:
result = true;
result = result && lowerBound.x <= aabb.lowerBound.x;
result = result && lowerBound.y <= aabb.lowerBound.y;
result = result && aabb.upperBound.x <= upperBound.x;
result = result && aabb.upperBound.y <= upperBound.y;
return result;
This seems to be the exact opposite.
You're right; fixed. Again, thanks for finding these.
Is the difference intended in b2ContactFilter.ShouldCollide?
Yes; it allows for reporting collisions between kinematic bodies (enabled by default). It's functionally the same, it just brings the body type check into the contact filter. I brought this up with Erin, but he decided against merging it upstream. https://github.com/erincatto/box2d/pull/349