OK. I have a method now.... I would love to see a better way since this is kinda hacky:
for (int i=1;i<LevelData.NumberOfLimbs;i++){
float lx,ly,lz;
lx=dbLimbPositionX(LevelMesh,i);
ly=dbLimbPositionY(LevelMesh,i);
lz=dbLimbPositionZ(LevelMesh,i);
dbMakeObjectFromLimb(100+i,LevelMesh,i);
sObject *O;
O=dbGetObject(100+i);
CalculateMeshBounds(O->pFrame->pMesh);
dbPositionObject(100+i,lx,ly,lz);
dbHideObject(100+i);
dbShowObjectBounds(100+i);
SC_SetupComplexObject(100+i,1,2);
}
to set it up.
dbPickScreen(dbMouseX(),dbMouseY(),1.0);
float dx1,dy1,dz1;
float dx2,dy2,dz2;
dx1=dbGetPickVectorX()+dbCameraPositionX();
dy1=dbGetPickVectorY()+dbCameraPositionY();
dz1=dbGetPickVectorZ()+dbCameraPositionZ();
dx2=dbGetPickVectorX()*10000.0+dbCameraPositionX();
dy2=dbGetPickVectorY()*10000.0+dbCameraPositionY();
dz2=dbGetPickVectorZ()*10000.0+dbCameraPositionZ();
tp1=-1;
if (SC_RayCast(LevelMesh,dx1,dy1,dz1,dx2,dy2,dz2,0)==1){
dbHideObject(LevelMesh);
for (int i=1;i<LevelData.NumberOfLimbs;i++){
dbHideObject(100+i);
}
int q;
tp1=SC_RayCastGroup(1,dx1,dy1,dz1,dx2,dy2,dz2,100);
dbShowObject(tp1);
float d1=SC_GetCollisionDistance();
dbPositionObject(3,(dbGetPickVectorX()*d1)+dbCameraPositionX()
,(dbGetPickVectorY()*d1)+dbCameraPositionY()
,(dbGetPickVectorZ()*d1)+dbCameraPositionZ());
}
for detection.
Any thoughts? I mean it works, but I would have liked to have something a little better.
The fastest code is the code never written.