[ODE] dCollideRTL issue: improper usage?
Vadim Macagon
vadim_mcagon at hotmail.com
Wed Aug 20 16:20:02 2003
Hi Chris,
This has actually been changed by one of my patches recently, so you need to
update
your ODE checkout from CVS, and hopefuly that will fix it.
Cheers,
Vadim.
----- Original Message -----
From: Chris Ledwith
To: ODE@q12.org
Sent: Thursday, August 21, 2003 9:06 AM
Subject: [ODE] dCollideRTL issue: improper usage?
Hello,
My collisions are reported back at incorrect coordinates. For example, if an
object in my space is at 1200, 30, 500, and I fire a ray at it, the
collision point comes back as 2400, 60, 1000 (or rather, in the neighborhood
of this). In other words there is a doubling of coordinates, as if a point
was translated from object space to world space, and then again to world
space. I've narrowed the problem down to these lines in dCollideRTL:
const dVector3& TLPosition = *(const
dVector3*)dGeomGetPosition(TriMesh);
const dMatrix3& TLRotation = *(const
dMatrix3*)dGeomGetRotation(TriMesh);
.
dVector3 dv[3];
FetchTriangle(TriMesh, TriIndex, TLPosition, TLRotation, dv);
dVector3 Temp;
GetPointFromBarycentric(dv, Faces[i].mU, Faces[i].mV, Temp);
dMULTIPLY0_331(Contact->pos, TLRotation, Temp);
Contact->pos[0] += TLPosition[0];
Contact->pos[1] += TLPosition[1];
Contact->pos[2] += TLPosition[2];
Contact->pos[3] = REAL(0.0);
FetchTriangle fills in dv with the world coordinates of the three vertices
of the intersected triangle, because it is passed the position and rotation
(in TLPosition, TLRotation, respectively) of the intersected geom. Then the
exact point of contact on the triangle is transformed to world coordinates
and placed in Temp. The problem then arises when Temp is transformed again
before filling in Contact->pos (the last block of code, above). This results
in the doubling of the world coordinates.
When I replace the last block of code with:
Contact->pos[0] = Temp[0];
Contact->pos[1] = Temp[1];
Contact->pos[2] = Temp[2];
Contact->pos[3] = REAL(0.0);
Collisions then work correctly in my application
Please, does anyone know the proper solution?
Thanks,
Chris Ledwith