Ray vs Trimesh collision

16 views
Skip to first unread message

artu...@gmail.com

unread,
Jun 28, 2009, 11:01:54 AM6/28/09
to ode-users

Dear ODE Friends,

I´d like to implement a raycaster to improve the collision detection
between a game character and the game´s word.

Game´s word is a triangle mesh and the game character uses a capsule
and a ray to detect collision. The ray is shot at the direction in
wich the character moves in order to avoid tunneling problem.

Well, I could read on this link: http://opende.sourceforge.net/wiki/index.php/Manual_(Collision_Detection)
that ODE is not able to detect Ray vs Trimesh collision if
dTRIMESH_ENABLED flag is not activated.

In fact , Ray vs trimesh is not been detected in my game.

I´d like to know if the information on the web link above is correct.
If yes , how to change the dTRIMESH_ENABLED flag and what the
implications and drawbacks of doing it.

Thanks !

artu...@gmail.com

Martijn Buijs

unread,
Jun 28, 2009, 11:35:09 AM6/28/09
to ode-...@googlegroups.com
artu...@gmail.com wrote:
>
> Dear ODE Friends,
>
> I悲 like to implement a raycaster to improve the collision detection
> between a game character and the game愀 word.
>
> Game愀 word is a triangle mesh and the game character uses a capsule

> and a ray to detect collision. The ray is shot at the direction in
> wich the character moves in order to avoid tunneling problem.
>
> Well, I could read on this link: http://opende.sourceforge.net/wiki/index.php/Manual_(Collision_Detection)
> that ODE is not able to detect Ray vs Trimesh collision if
> dTRIMESH_ENABLED flag is not activated.
>
> In fact , Ray vs trimesh is not been detected in my game.
>
> I悲 like to know if the information on the web link above is correct.

> If yes , how to change the dTRIMESH_ENABLED flag and what the
> implications and drawbacks of doing it.
>
> Thanks !

You can compile ODE without trimesh collision code, because it depends on a large set of routines
that increase compile time, executable size and may not compile without problems on all platforms.
If you want to do *anything* with trimesh, you'll need to define dTRIMESH_ENABLED in your
ode/src/config.h (it is explained there in the comments). This will include ray-trimesh,
capsule-trimesh collision routines.

If capsule collisions work for you, but not rays, check your nearCallback function. Also, verify
that the ray geom is set up properly.

Naturally, make sure you have the latest ODE version/revision. An older version of the GIMPACT
trimesh collider had a bug with ray collisions, the default trimesh collider (OPCODE) has always
been stable though.

/Remdul

Artur Corrêa

unread,
Jun 28, 2009, 4:54:25 PM6/28/09
to ode-...@googlegroups.com
I´m usin the ODE 0.11 with Gimpact.

Well. Trimesh x Trimesh , Trimesh x sphere , Trimesh x Box , Trimesh x capsule are working in my software, so I think it is suposed Ray x Trimesh should work at all.

Is there a different callback to treat ray collision detection ?

Thanks !

On Sun, Jun 28, 2009 at 12:35 PM, Martijn Buijs <buij...@planet.nl> wrote:

artu...@gmail.com wrote:
>
> Dear ODE Friends,
>
> I´d like to implement a raycaster to improve the collision detection

> between  a game character and the game´s word.
>
> Game´s word is a triangle mesh and the game character uses a capsule

> and a ray to detect collision. The ray is shot at the direction in
> wich the character moves in order to avoid tunneling problem.
>
> Well, I could read on this link: http://opende.sourceforge.net/wiki/index.php/Manual_(Collision_Detection)
> that ODE is not able to detect Ray vs Trimesh collision if
> dTRIMESH_ENABLED flag  is not activated.
>
> In fact , Ray  vs trimesh is not been detected in my game.
>
> I´d like to know if the information on the web link above is correct.

> If yes , how to change the dTRIMESH_ENABLED flag and what the
> implications and drawbacks of doing it.
>
> Thanks !

Martijn Buijs

unread,
Jun 28, 2009, 6:39:21 PM6/28/09
to ode-...@googlegroups.com
Artur Corręa wrote:
> I´m usin the ODE 0.11 with Gimpact.
>
> Well. Trimesh x Trimesh , Trimesh x sphere , Trimesh x Box , Trimesh x
> capsule are working in my software, so I think it is suposed Ray x
> Trimesh should work at all.
>
> Is there a different callback to treat ray collision detection ?
>
> Thanks !

No, the callback is the same. Can you post your dRay geom code?

/Martijn

Artur Corrêa

unread,
Jun 29, 2009, 7:18:03 AM6/29/09
to ode-...@googlegroups.com
The code is incapsulated on my game engine, so I think is difficult to post the code without explanning all the architecture. But basicly what I do is to create a rayGeom, insert it on collision space , modify lenght and position using dGeomRaySetLenght and dGeomRaySet each game frame, and wait for collision callback.

I organized the scene in order to have only the ray geon and the trimesh. So I`m sure that
the ray collides with the trimesh. In fact the near collision callback is  called, but I get no collision contacts when I call dCollide with the two geoms.

 
On Sun, Jun 28, 2009 at 7:39 PM, Martijn Buijs <buij...@planet.nl> wrote:
Reply all
Reply to author
Forward
0 new messages