/* Toy Fonction for Game moteur*/ /* #include "ACP_Base.h" #include "ToolsCPA.h" #include "CPALib.h" #include "ColMotor.h" #include "Structur/MemGame.h" #include "GameEng.h" #include "ZeMem.h" //a few define #define COL_C_NbMaxObjectInCollision 11 #define COL_C_InSphere 0 #define COL_C_OutSphere 1 #define COL_C_InContact 2 //local prototypes //char COL_xCollideSphere(HIE_tdxHandleToSuperObject COL_p_stSO1,HIE_tdxHandleToSuperObject COL_p_stSO2); long fn_lObjectCollideWithCamera ( HIE_tdxHandleToSuperObject COL_p_stTreeToExplore, HIE_tdxHandleToSuperObject COL_p_stCameraToCollide, long COL_lTypeToSearch, HIE_tdxHandleToSuperObject *COL_d_stArrayOfSOInCollision, long COL_lPositionOfStart, long COL_lPositionMax ); // function COL_xCollideSphere() /* This function indicates if SO2 is in,out or in contact with SO1. The test of collision uses the sphereBox.*/ /*char COL_xCollideSphere(HIE_tdxHandleToSuperObject COL_p_stSO1,HIE_tdxHandleToSuperObject COL_p_stSO2) { MTH3D_tdstVector COL_stCenter1,COL_stCenter2; // The center of each SphereBox in absolue MTH_tdxReal COL_xDistanceBetweenCenter; // Distance between the centers //compute the coordinate of the center of SO1 POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectMatrix(COL_p_stSO1),&COL_stCenter1 ); MTH3D_M_vAddVector(&COL_stCenter1,&COL_stCenter1,&(HIE_fn_hGetSuperObjectSphere(COL_p_stSO1)->stCentre)); //compute the coordinate of the center of SO2 POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectMatrix(COL_p_stSO2),&COL_stCenter2); MTH3D_M_vAddVector(&COL_stCenter2,&COL_stCenter2,&(HIE_fn_hGetSuperObjectSphere(COL_p_stSO2)->stCentre)); //calculate the distance between the centers MTH3D_M_vSubVector(&COL_stCenter1,&COL_stCenter1,&COL_stCenter2); // take the vector COL_xDistanceBetweenCenter=MTH3D_M_xNormVector(&COL_stCenter1); // determine the output if ( COL_xDistanceBetweenCenter < MTH_M_xSub(HIE_fn_hGetSuperObjectSphere(COL_p_stSO1)->xRadius,HIE_fn_hGetSuperObjectSphere(COL_p_stSO2)->xRadius) ) return COL_C_InSphere; //SO2 in SO1 if ( COL_xDistanceBetweenCenter < MTH_M_xAdd(HIE_fn_hGetSuperObjectSphere(COL_p_stSO1)->xRadius,HIE_fn_hGetSuperObjectSphere(COL_p_stSO2)->xRadius) ) return COL_C_InContact; // SO2 in contact with SO1 return COL_C_OutSphere; // no contact } // end of COL_xCollideSphere // version temp with exploration of the tree // function fn_lObjectCollideWithCamera() long fn_lObjectCollideWithCamera ( HIE_tdxHandleToSuperObject COL_p_stTreeToExplore, HIE_tdxHandleToSuperObject COL_p_stCameraToCollide, long COL_lTypeToSearch, HIE_tdxHandleToSuperObject *COL_d_stArrayOfSOInCollision, long COL_lPositionOfStart, long COL_lPositionMax ) { long COL_lCounterCollision,COL_lI; HIE_tdxHandleToSuperObject COL_p_stpChild; COL_lCounterCollision=COL_lPositionOfStart; if(COL_lCounterCollision