void CPedModelInfo::CreateHitColModelSkinned(RpClump* clump) { RpHAnimHierarchy* hier = GetAnimHierarchyFromSkinClump(clump); CColModel* hitColModel = new CColModel; RwMatrixTag* frameInverseMat = CGame::GetWorkingMatrix1(); RwMatrixTag* transformMatrix = CGame::GetWorkingMatrix2(); hitColModel->AllocateData(12, 0, 0, 0, 0, 0); RwMatrixInvert(frameInverseMat, &RpClumpGetFrame(clump)->modelling); for (size_t i = 0; i < ELEMS_COUNT(m_pColNodeInfos); i++) { CColSphere colSphere; colSphere.Set(m_pColNodeInfos[i].sphere.GetRadius(), m_pColNodeInfos[i].sphere.GetCenter()); CCollisionData* colData = hitColModel->GetColData(); *transformMatrix = *frameInverseMat; RwInt32 matIndex = RpHAnimIDGetIndex(hier, m_pColNodeInfos[i].animId) << 6; RwMatrix* mat = (RwMatrix*)(RpHAnimHierarchyGetMatrixArray(hier) + matIndex); RwMatrixTransform((RwMatrix *)transformMatrix, mat, rwCOMBINEPRECONCAT); RwV3dTransformPoints(&colSphere.center, &colSphere.center, 1, (RwMatrix *)transformMatrix); colSphere.SetSurfaceTypeA(EColSurface::PED); colSphere.SetSurfaceTypeB(m_pColNodeInfos[i].surfaceTypeB); colData->SetSphere(i, colSphere); } CBoundingBox boundingBox; CVector maxbb(0.5f, 0.5f, 1.2f); CVector minbb(-0.5f,-0.5f,-1.2f); CBox box; box.Set(minbb, maxbb); boundingBox.SetBoundingSphere(CSphere(0, 0, 0, 1.5f)); hitColModel->SetBoundingBox(boundingBox); hitColModel->SetColNum(0); m_hitColModel = hitColModel; }
/** * @desc setCollisionData * @param CCollisionData */ void CCollisionData::set(const CCollisionData &data){ this->m_position = data.getPosition() ; this->setApexs(data.getApexs()) ; }
/** * @desc set * @param CCollisionData */ inline void set(const CCollisionData &data){ this->m_position = data.getPosition() ; this->setApexs(*data.getApexs()) ; this->m_radius = data.getRadius() ; this->m_angle = data.getAngle() ; }