[ODE] tricollider question

Nate W coding at natew.com
Thu Jul 11 23:35:02 2002


On Fri, 12 Jul 2002 maddocks@met.co.nz wrote:

> What does this mean, or more correctly, what does the author think this 
> means...
> 
> dcVector3& Pos = (dcVector3&)BoxContacts[j].pos;
> 
> I'm trying to compile the tricollider stuff with gcc and it complains 
> about this. As far as I can tell this isn't a valid expression.

The same line is in the version I have, and it built under MSVC (this
compiler isn't famous for its compliance, though).

The line creates a dcVector3 reference named Pos, and initializes it with
"pos" field of the j-th element of the BoxContacts array.  The ".pos"
member is an object of type dVector3 (an ODE type) and the reference is of
type dcVector3 (declared in dxTriList.h), so this only works (if it works
at all) with an explicit cast.

I suspect that gcc's objection stems from the fact that dVector3 is an
array of four (yes, four) dReals, and dcVector3 is a struct with three
floats.

Are you compiling ODE with dSINGLE, or dDOUBLE?  I had no luck with the
tri-collider and dDOUBLE, so I switched to dSINGLE.  That might help in
your case, but I'm not promising.  It's still a slightly unsettling
cast... but isn't that what casts are for? :-)

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com