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

gl gl at ntlworld.com
Wed Jan 1 04:09:02 2003


I actually patched this together myself yesterday.  As far as I can tell
(and it seems all non-list information on this is out of date), Erwin's
patch posted to this list in August is the most recent public version of the
tri-collider, and was written to work with Opcode1.2
http://q12.org/pipermail/ode/2002-August/001646.html.

I've managed to get the included test .exes working with Opcode1.2 without
any major modifications.  The only main change was using the ray class now
included in the lastest CVS version of ODE, rather than the dRay found in
the patch - that just took just commenting out a couple of lines.  Not sure
if this is safe though - the demos do mostly work fine, but there seems to
be an issue with collision geoms hitting triangle edges.  In the bunny demo
for example, sometimes boxes hitting a bunny edge fly way off as if too much
intersection ocurred.  I noticed something about this in the list archives
though - I believe Erwin has code that addresses this?

Erwin, are there newer versions to test?

Some tips for Opcode1.2:
    needs to be compiled a a static lib.
    needs this preprocessor define: OPC_USE_CALLBACKS (that foxed me for a
while ; ).
    in Opcode.h, comment out
        //#ifdef OPCODE_EXPORTS
        //#define OPCODE_API __declspec(dllexport)
        //#else
        // #define OPCODE_API __declspec(dllimport)
        //#endif
    and add this below:
        #define OPCODE_API

I'm currently finishing my non-trilist collision support, and it's already
great fun bouncing things around in my engine.  Thanks again to Russ, Erwin,
and everyone else contributing.
--
gl

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


>
> ----- 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;
> >
> >
> >
> >
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode
>