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

Jürgen Ladstätter info at innova-studios.com
Sat Mar 25 04:41:49 MST 2006


the ray position is my current camera position. ray direction is calculated and to ensure that it's correct, i'm drawing a box at that point.
-> look at this screen and you see that it's correct: http://forum.innova-studios.com/uploads/cd.jpg
The green box shows me where the box for the collision detection is and the second (the red one) shows me where the rkRay.m_kDirection point is.

so i don't see my error :-/
  ----- Original Message ----- 
  From: LR 
  To: ode at q12.org 
  Sent: Saturday, March 25, 2006 11:24 AM
  Subject: Re: [ODE] collision detection problems ... ray and box


  Are you sure the Ray position and RAy direction (rkRay.m_kOrigin, rkRay.m_kDirection) are good ? 
  It work fine for me ...

  Laurent.




------------------------------------------------------------------------------
  De : ode-bounces at q12.org [mailto:ode-bounces at q12.org] De la part de Jürgen Ladstätter
  Envoyé : samedi 25 mars 2006 10:48
  À : ode at q12.org
  Objet : [ODE] collision detection problems ... ray and box


  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


------------------------------------------------------------------------------


  _______________________________________________
  ODE mailing list
  ODE at q12.org
  http://q12.org/mailman/listinfo/ode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060325/e0eb9e95/attachment.htm


More information about the ODE mailing list