[ODEjava] how to use Ode.dCollide()?

Ode.dCollide(SWIGTYPE_p_dGeomID o1,SWIGTYPE_p_dGeomID o2,int flags,dContactGeom contact,int skip);

How can I determine the ‘flags’ and ‘skip’ parameter?
The document said flags is the num of collide data you want to get, but if I want to get all, how to set it?

What’ more, the ‘skip’ is the size of dContactGeom class, how to get its size?

Thanks!

any reason you are using the low level Ode class?

Will.

The reason is that I would like to simulate an infra-red sensor, which will return the distance data of the nearest object on its radial way.

The infra-red sensor can be used for avoiding obstacle.

The principle is quite like a GeomRay, which can be used to get the distance between its origin and the contact point with another object.

So I would like to use the ODE.dCollide() for it. In fact, the GeomRay is not quite useful for me, what I want to get is the distance which will be returned by the function.

I hope I have explained clearly. I don’t know how to set the parameters for the dCollide() function.

I will be glad to know if there’s better method. :slight_smile:

I’m currently thinking about implementing the same thing … a cone shaped collision volume. What would be the best way of doing this since GeomCone is not implemented in Odejava. My last resort would be to fill a cone volume with spheres of appropriate sizes. Any other ideas?

it would probably be easier to implement it correctly :wink: - The class for that already exists

please elaborate.

doesn’t the GeomCone already exist in ODE? - so only the native binding to it would have to be coded…if it doesn’t exist - ok, then I’ll take my comment back.

well, there is an odejava class for GeomCone, with a constructor which looks like this:

public GeomCone(String name, float radius, float length) {
        super(name);
        spaceId = Ode.getPARENTSPACEID_ZERO();
    //  geomId = Ode.dCreateCone(spaceId, radius, length);

        updateNativeAddr();
    }

…notice the commented-out call. the function itself is missing in the Ode class, so I guess the native interface for it is not implemented either.

the other thing is, GeomCone is a contributed geometry class for ODE if I’m not mistaken, so I can only guess wheter it is or is not compiled into the Odejava natives dll.

mmh so this probably would go with an update of the native lib. I don’t have much problems with that (but I don’t know how it looks with the community), but you could try to look how much would have to be changed, if we’re using the newer version (maybe we’ll also get less bugs and so)…