[ODE] collision detection problems ... ray and box

Jürgen Ladstätter info at innova-studios.com
Sat Mar 25 02:48:02 MST 2006


hi there all,

i don't know wheter its an ODE error or my mistake that i forgot smth ...
let me discribe the way i implemented it today ...

first of all i create a quadtreespace for my items with which i wanna make the CD (collision detection).

dVector3 center, size;
center[0] = 0.0f; center[1] = 0.0f; center[2] = 0.0f; center[3] = 0.0f;
size[0] = 1000.0f; size[1] = 1000.0f; size[2] = 1000.0f; size[3] = 0.0f;
g_ikCDSpace = dQuadTreeSpaceCreate( 0, center, size, 5 );

then i add some boxes to my space and add those ids to a vector queue, so that i can fetch them faster in the future

VertexPoint sVertex;
sVertex.bEnabled = true;
sVertex.gidCDBox = dCreateBox ( g_ikCDSpace, 20.0f, 20.0f, 20.0f);
m_vBV.push_back( sVertex );
m_viEnd   = m_vBV.end();

when i'm clicking now on my screen i calculate the origin for my ray and the direction, and then do some CD - but it doesnt work :(

m_viStart = m_vBV.begin();
dGeomID testray = dCreateRay (g_ikCDSpace, 1000.0f);
dGeomRaySet( testray, rkRay.m_kOrigin[0], rkRay.m_kOrigin[1], rkRay.m_kOrigin[2], rkRay.m_kDirection[0], rkRay.m_kDirection[1], rkRay.m_kDirection[2]);
dGeomRaySetLength (testray,10000);
dContactGeom contact;

for( ; m_viStart != m_viEnd; m_viStart++ )
{
 if( dCollide( testray,m_viStart->gidCDBox,0,&contact,sizeof(dContactGeom)) != 0)
 {
  neolog << "yuhuu";
  m_viStart->bEnabled = false;
  return distance( m_vBV.begin(), m_viStart );
 }
}

thats all what i implemented so far but it doesnt work. is there any need to call an update function in the rendercycle or smth like that?
any malicious ideas? ;)


Thanks in advance, Jürgen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060325/bf121abd/attachment.htm


More information about the ODE mailing list