Skip to content

Strange error based on collision listener (when the line is straight, the collision doesn't pick up) #128

@Pagaurus

Description

@Pagaurus

Hello everyone, I'm creating a level editor with the physics engine (wasm variant), and I noted some strange behaviour with the collision listener. When the ball reaches the edge of the screen, the ball is deleted, except in the following case:
Image
Then, when I change the rotation of that platform which is holding the balls:
Image
So, it seems like in the first screenshot, the platform is at such an angle where the collision listeners don't pick up the new collision, and they roll through it.

listener = new Box2D.JSContactListener();

listener.BeginContact = function (contactPtr) {
	var contact = Box2D.wrapPointer( contactPtr, Box2D.b2Contact );
	var fixtureA = contact.GetFixtureA();
	var fixtureB = contact.GetFixtureB();

	if(fixtureA.GetType() == 1){
		body = fixtureB.GetBody();
		
		deleteList.push(userData[body.GetUserData()]);
	}
}

listener.EndContact = function() {};
listener.PreSolve = function() {};
listener.PostSolve = function() {};

world.SetContactListener(listener);

This is the code being used for collision handling. It's not a problem for me, I'm just curious why it's happening and thought the Box2D team might like to know about it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions