[Odejava] Contact help

Hi,
Ive been messing around with Ode, and im impressed. Good work.

One thing tho, is that im trying to get the names (or the actual Geom) from a collision.

I am doing this:


            // collide objects in a given space
            collision.collide(space);
            
            // read and modify contact information
            iterateContacts();
            
            // apply the contact information for the collisions
            collision.applyContacts();
            
            // and step fast in the world
            world.stepFast();

Btw, collision is a type of JavaCollision;

And iterateContacts is:


            for (int i = 0; i < collision.getContactCount(); i++) {
                  contact.setIndex(i);
                  contact.setMode(Ode.dContactBounce | Ode.dContactApprox1);
                  contact.setBounce(0.004f);
                  contact.setBounceVel(0.002f);
                  contact.setMu(100f);
            }

Now I can get their ID’s:

contact.getGeomID1(); and that returns an int, not a String or a Geom object.

Any ideas?

grab the latest from CVS - I have added some methods to get an actual Geom.

Will.

Sorry, i cant seem to find this method.

Would you please tell me what its called and under which class are you referring to?

Thx

Sure.

The class is org.odejava.collision.Contact

The methods are getGeom1(), getGeom2(). These have a O(log n) time penalty (the cost of accessing a hashmap). Other new methods are: geom1EqualTo() and geom2EqualTo() which have an O(1) time cost (integer comparison).

I can easily add comparable getBody1(), getBody2() methods as well.

NOTE: Not only did I add those methods but I fixed up a few bugs so I strongly suggest using the latest code in any case.

Will.