[ODE] Re: Problems w/ tri-collider and ODE 0.035

Paul T. Pham ppham at colony.mit.edu
Wed Jan 1 01:20:02 2003


----- Original Message -----
From: "Paul T. Pham" <ppham@mit.edu>
To: <ode@q12.org>
Sent: Wednesday, January 01, 2003 2:43 AM
Subject: Problems w/ tri-collider and ODE 0.035


> Hi all,
>
> I am trying to compile the tri-collider code in contrib with
> ODE 0.035 and OPCODE 1.2; I just changed the reference in
> dcTriListCollider.cpp to dCollideBP to dCollideBoxPlane in the new
>  collision detection code. However, my C++ compiler has me stumped
>  on some of the trickier reference casting code, for example:
>
> >>
> src/ode/dcTriListCollider.cpp:130: conversion to non-const reference type
`
>    struct dcVector3&' from rvalue of type `dReal*'
> src/ode/dcTriListCollider.cpp:131: conversion to non-const reference type
`
>    struct dcVector3&' from rvalue of type `dReal*'
> src/ode/dcTriListCollider.cpp:145: conversion to non-const reference type
`
>    struct dcVector3&' from rvalue of type `dReal*'
> src/ode/dcTriListCollider.cpp:147: conversion to non-const reference type
`
>    struct dcVector3&' from rvalue of type `dReal*'
> >>
>
> I know the notes say only to use OPCODE 1.0, but these problems
> don't seem to be related to OPCODE. Out of curiosity, does anyone
> know what part of OPCODE 1.2 is incompatible? It appears to
> compile and link fine for me.
>
> So I did some kludges below to get it to compile; unfortunately
> I am also learning C++ at the same time :) So it compiles fine
> with gcc-3.2.1 and libstdc++-v3, but when I run test_trilist,
> boxes drop straight through the triangle-mesh, even past the
> ground plane. Spheres bounce just fine. Using printfs, I can tell
> that the correct contact points are generated in dCollideBoxPlane,
> but that my kludges are wrong somehow.
>
> Can someone tell me the best way to make this work?
> I guess I could just use ODE 0.033, but it seems like it would
> be so easy to get it to work with 0.035, and the typechecking
> errors seem like its independent of the ODE version. I
> don't know a lot about collision detection, so it would take
> me a really long time to read the code and figure out what all
> the referencing and casting was supposed to do.
>
> Also, if someone already has gotten ODE, tri-collider, OPCODE,
> Demeter, and OpenSceneGraph to play nice with each other, I would
> greatly appreciate seeing your source code.
>
> Thanks in advance, and Happy New Year,
> Paul
>
> >> (incorrect) changes to dcTriListCollider.cpp
> Lines 130-131
>      dcVector3& Pos = (dcVector3&)BoxContacts[j].pos;
>      dcVector3 Normal = ((dcVector3&)BoxContacts[j].normal) * -1;
> become
>    dcVector3* temp = (dcVector3*)BoxContacts[j].pos;
>    dcVector3&Pos = *temp;
>    dcVector3* temp2 = (dcVector3*)BoxContacts[j].normal;
>    dcVector3 Normal = (*temp2) * -1;
>
> Line 145
>       float DistSq = ((dcVector3&)Ref->pos - Pos).MagnitudeSq();
> becomes
>      dcVector3* temp = (dcVector3*)Ref->pos;
>      dcVector3& temp2 = *temp;
>      float DistSq = (temp2 - Pos).MagnitudeSq();
>
> Line 252
>       const dcVector3& RefNormal = (dcVector3&)RefContact->normal;
> becomes
>      dcVector3* temp = (dcVector3*)RefContact->normal;
>      const dcVector3& RefNormal = *temp;
>
> Line 276
>     OutNormal += ((dcVector3&)Contact->normal) * Contact->depth;
> become
>      dcVector3* temp = (dcVector3*)Contact->normal;
>      dcVector3& temp2 = *temp;
>      OutNormal += temp2 * Contact->depth;
>
>
> Lines 279-280
>     ((dcVector3&)OutContact.pos) = SphereCenter - OutNormal *
SphereRadius;
>     ((dcVector3&)OutContact.normal) = OutNormal * -1;
> become
>     dcVector3 temp = SphereCenter - OutNormal * SphereRadius;
>     OutContact.pos[0] = temp.x;
>     OutContact.pos[1] = temp.y;
>     OutContact.pos[2] = temp.z;
>     dcVector3 temp2 = OutNormal * -1;
>     OutContact.normal[0] = temp2.x;
>     OutContact.normal[1] = temp2.y;
>     OutContact.normal[2] = temp2.z;
>     OutContact.depth = Depth;
>
>
>
>