[ODE] Bug in Ray-Trimesh collision implementation

Adam D. Moss adam at gimp.org
Fri Mar 18 13:36:16 MST 2005


Sawyer wrote:
> Thanks this is exactly the information I needed to know.  That said, it didn't 
> work.

Uh-oh.

> Here are the two compiling and non-crashing variations I tried, neither of 
> them fixed the problem.
> 
> (RayProximity::UpdateCallback)
>     // Check for ray/geom intersections
>     if ( rayGeom && hitGeom )
>     {
>       dGeomRaySetParams((dxGeom*)rayGeom, 1, 1);
>       dGeomRaySetClosestHit((dxGeom*)rayGeom, 1);
>       n = dCollide(o1, o2, 1, &contact, sizeof(contact));
>       if ( n > 0 )
>       {
>         if (contact.depth < rayGeom->contactDepth)
>         {
>           //printf("%p %p %f \n", o1, o2, contact.depth);
>           rayGeom->contactDepth = contact.depth;
>           rayGeom->contactRetro = hitGeom->GetRetro();
>           rayGeom->contactFiducial = hitGeom->GetFiducial();
>         }
>       }
>     }

Do you mean dGeomRaySetClosestHit((dxGeom*)o1 [or o2], 1);?
Guessing by rayGeom->contactFiducial, which isn't an attribute of
a dxGeom, rayGeom isn't a dxGeom (or you have subclassed it).

[..]
>       dGeomRaySetClosestHit((dxGeom*)rayGeom, 1);
[..]

Same here.

> Do I need to increase the number of collisions processed (if I just increase 
> the number above 1 I get a run-time crash, I would need to look further into 
> the size of the memory passed).

I don't know if this would help for a ray-trimesh collision.  If you
want to try it then you can reasonably expect a crash if you're just
passing in a pointer to a single contact struct:
        n = dCollide(o1, o2, 1, &contact, sizeof(contact));
Instead you'd have to pass a pointer to a suitably-sized arrays of
contact structs instead.

--Adam
-- 
Adam D. Moss   -   adam at gimp.org


More information about the ODE mailing list