[ODE] Implementing a pick. worked in 0.39 but not in 0.5

Hampus Soderstrom hampus at sxp.se
Mon Feb 14 18:05:28 MST 2005


Hi,

I have the following code in response to a mouse click:

It worked in 0.39 but now that I have upgraded to 0.5 my ray collides 
with alot of bodies.

If I draw out the ray it has the correct length and direction.

This is my picking code:

//print out what body user clicked on
static void pick(float start[3], float end[3]){

         dGeomID g = NULL;
         dContactGeom contact;

         dGeomRaySet(ray, start[0], start[1], start[2], end[0]-start[0], 
end[1]-start[1], end[2]-start[2]);
         dGeomRaySetLength(ray, 100);

	for(int i = 0; i < NUM_BODYS; i++){

		g = box[i];
		if (int numc = dCollide (ray,g, 0,&contact, sizeof(dContact))) {
                    	printf("collision with %s\n", get_body_name(i));
			dGeomRaySetLength(ray, 0);
			return;
		}
	}
}

cheers
/Hampa
SXP



More information about the ODE mailing list