Is there something you need to do differently to find a collision with animated Characters
It seems to only detect hit on the first frame of a boned-mesh animation character.
this is the loading of the mesh
dbObject *obj = new dbObject("DirectX\\tommy.x", 1000 );
obj->Position(434,44,-400);
//obj->Texture(999);
dbYRotateObject ( 1000, -180 );
obj->FixPivot();
//obj->Play(0,1);
//obj->Loop();
//obj->SetSpeed(30);
StoreObject(obj);
::SC_SetupObject(1000,1,0);
//SC_SetupComplexObject( 1000,1,4 );//
::dbGlueObjectToLimb(900,1000,41);
obj->Play(2498,2498);
SC_UpdateObject(1000);
this is the code in the player movement
dbPositionObject( ID,x,oldy,z );
//dbRotateObject (2, 90,90,90);
SC_UpdateObject( ID );
this is the fire bullet code
void thegame::FireBullet()
{
int collide = 0;
int BULLET_ID=500;
int BULLET_FIRE_SOUND_ID=1;
float oldx = dbCameraPositionX();
float oldy = dbCameraPositionY();
float oldz = dbCameraPositionZ();
dbMoveCamera( 1000 );
float x = dbCameraPositionX();
float y = dbCameraPositionY();
float z = dbCameraPositionZ();
dbMoveCamera( -1000 );
collide = SC_RayCast( 0, oldx,oldy,oldz, x,y,z, 0 );
if ( collide > 0 )
{
//get the collision point
float newx = SC_GetStaticCollisionX();
float newy = SC_GetStaticCollisionY();
float newz = SC_GetStaticCollisionZ();
//get collision normal
float normx = SC_GetCollisionNormalX();
float normy = SC_GetCollisionNormalY();
float normz = SC_GetCollisionNormalZ();
// fade out over time
//position and point a marker in the right direction
dbPositionObject( BULLET_ID, newx + normx/100.0f, newy + normy/100.0f, newz + normz/100.0f );
dbPointObject( BULLET_ID, newx + normx, newy + normy, newz + normz );
dbShowObject( BULLET_ID );
}
//::dbPlaySound(BULLET_FIRE_SOUND_ID);
}
everyhting works great for static and framed based animation - only the meshws are a problem
Rob Toutant