jhasse/chipmunkpp

Collision handler docs

BrownNPC opened this issue · 1 comments

I'm kinda struggling to add collison handlers. I added a collision type to my rigid bodies, now how exactly do i pass a collison function to space.AddCollisionHanlder? Some explanation for this would be cool.

You would probably use a lambda. E.g. for postSolve:

space.addCollisionHandler(TypeA, TypeB,
    nullptr,
    nullptr,
    [this](Arbiter a, Space& s) { yourMemberFunction(a, s); },
    nullptr
);

Does this help? If so I could add it in a docstring.