Possible incompatibility with ODE!

Hello,

As i described in the topic below, i want to test collision of two geoms with odejava.

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=physics;action=display;num=1114546020

When i looked for the problem in Odejava sources, i found the following lines in the methods written in odejava.cpp:


// This callback collects all contacts data (dContactGeom) to buffers which
// can be later accessed on the Java side.
// Used with spaceCollide
static void nearCallback (void *data, dGeomID o1, dGeomID o2) {   
  // This function is called by ODE if two Geoms are near each other.
  // Geoms o1 and o2 are near each other, if they actually collide then
  // generate contact information (dContact structure) and add them
  // to contact jointgroup.

  dBodyID b1 = dGeomGetBody(o1);
  dBodyID b2 = dGeomGetBody(o2);

  // ignore if both o1 and o2 are plain Geoms (not bodies)
  if (!b1 && !b2) return;

  .....




// This callback collects all contacts data (dContactGeom) to buffers which
// can be later accessed on the Java side.
// Used with spaceCollide2
static void nearCallback2 (void *data, dGeomID o1, dGeomID o2) {   
  // This function is called by ODE if two Geoms are near each other.
  // Geoms o1 and o2 are near each other, if they actually collide then
  // generate contact information (dContact structure) and add them
  // to contact jointgroup.
  if (dGeomIsSpace (o1) || dGeomIsSpace (o2)) {
      // colliding a space with something
      dSpaceCollide2 (o1,o2,data,&nearCallback);
      // collide all geoms internal to the space(s)
      if (dGeomIsSpace (o1)) dSpaceCollide ((dSpaceID) o1,data,&nearCallback);
      if (dGeomIsSpace (o2)) dSpaceCollide ((dSpaceID) o2,data,&nearCallback);
  } else {

    dBodyID b1 = dGeomGetBody(o1);
    dBodyID b2 = dGeomGetBody(o2);

    // ignore if both o1 and o2 are plain Geoms (not bodies)
    if (!b1 && !b2) return;

    .....


It seems that collision of two geoms are ignored in the implementation.

Here is the related “collision” section from ode user guide:

http://www.ode.org/ode-latest-userguide.html#sec_10_2_0

So, it seems that the current behavior is not compatible with what ODE says. I think this is done to improve performance in odejava. So, what are your thoughts? Should we compliant to ode or select performance option? Are there anybody using geom-geom collision?

Thanks for the opinions.

Personnally, I don’t see the use to detect geom-geom collisions, because they’re not moving.
And if you manually makes geoms move, you don’t use Odejava correctly.

Hello,

I am sorry for the late response. I needed to re-register to the forums. :frowning:

I need collision detection engine in ODE. Since there are no available OPCODE binding for Java now (as far as i know), i am trying to test the performance of collision detection in odejava before trying to develop an OPCODE binding for Java.

It seems that nobody needs geom collision nowadays. :slight_smile:

By the way, i removed ‘if’ statements (mentioned in the original message) from the code (in fact there is one more ‘if’ there) and it worked.

This post may help the guys who wants to try collision detection engine and get strange results in odejava.

Regards.

So can we improve Odejava by making this a switchable option? I’m all for it if we can.

Will.

Hi,

I am sorry for late response.

I think it is better to conform to the ode user guide. So we just need to remove those if statements from the code. (3 of them)

If collision without geoms is needed (for speed) we can easily add another method to that file and to the higher level api.

I shall do this next time we do a native build.

Is this urgent for you?

Will.

No, dont worry about it. No need to be done in a hurry.

I just wanted to report this to the community.

Thanks again.

ok great. thank you for telling us :slight_smile: we will do something about it next time we rebuild.

Cheers,

Will.