-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b509582
commit 6ecd2b3
Showing
8 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
// | ||
// (c) 2023 Eduardo Doria. | ||
// | ||
|
||
#ifndef Box2DContactFilter_h | ||
#define Box2DContactFilter_h | ||
|
||
#include "box2d.h" | ||
#include "subsystem/PhysicsSystem.h" | ||
|
||
namespace Supernova{ | ||
|
||
class Box2DContactFilter : public b2ContactFilter{ | ||
private: | ||
Scene* scene; | ||
PhysicsSystem* physicsSystem; | ||
|
||
public: | ||
|
||
Box2DContactFilter(Scene* scene, PhysicsSystem* physicsSystem){ | ||
this->scene = scene; | ||
this->physicsSystem = physicsSystem; | ||
} | ||
|
||
bool ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB){ | ||
size_t shapeIndexA = fixtureA->GetUserData().pointer; | ||
Entity entityA = fixtureA->GetBody()->GetUserData().pointer; | ||
Body2D bodyA(scene, entityA); | ||
|
||
size_t shapeIndexB = fixtureB->GetUserData().pointer; | ||
Entity entityB = fixtureB->GetBody()->GetUserData().pointer; | ||
Body2D bodyB(scene, entityB); | ||
|
||
return physicsSystem->shouldCollide2D.callRet(bodyA, shapeIndexA, bodyB, shapeIndexB, true); | ||
} | ||
}; | ||
|
||
} | ||
|
||
#endif //Box2DContactFilter_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters