I try to implement collision detection in latest JiglibX using this example http://jiglibx.wikidot.com/catch-collisionevents . I choose creating callback. I try to detect collision only once. When object falls through another callback is invoked multiple times, not only once. Is there any way how to ignore other calls? Thanks for advice.
What you need is to create a system to manage this for you. I have a list of bodies that each body is colliding with at any given time, I build this list based on the events I receive from JigLibX. At the end of each physics simulation step I update the list. Any new entries in the list that weren't there during the last step are new collisions, and I will send out an event for each of those that I find. Any collisions that were there during the last step that aren't there now are collisions that have ended, and I send out an event for all of those. And any collisions that I receive that were already in the list I do nothing for. Here's a visualization
My list for collisions is currently empty before step 1. After step one my list looks like:
After simulation step 2, my list looks like this:
You can see here we have a collision in the above list that is new (2<->5), I would send out events for that collision. There is also a collision from the first list that is no longer in the list after step 2, and that is 1<->2, which I would send out events for as well.
Using a system like I've described above means that you only have to receive a collision event when a new collision occurs, or when a collision ends.
You can see this system implemented in the QuickStart Game Engine, which uses XNA with JigLibX, it's a free download.
I don't know of any way to make JigLibX not send collision events each frame. Each physics engine I've used did this every frame (simulation step).