Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences to original box2d #75

Open
Lusito opened this issue Oct 17, 2020 · 5 comments
Open

Differences to original box2d #75

Lusito opened this issue Oct 17, 2020 · 5 comments

Comments

@Lusito
Copy link

Lusito commented Oct 17, 2020

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.

@flyover
Copy link
Owner

flyover commented Oct 17, 2020

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.

@Lusito
Copy link
Author

Lusito commented Oct 23, 2020

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.

@flyover
Copy link
Owner

flyover commented Oct 23, 2020

You're right; fixed. Again, thanks for finding these.

@Lusito
Copy link
Author

Lusito commented Oct 26, 2020

Is the difference intended in b2ContactFilter.ShouldCollide?

@flyover
Copy link
Owner

flyover commented Oct 26, 2020

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. erincatto/box2d#349

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants