bool CTriggerFX::Init( HLOCALOBJ hServObj, ILTMessage_Read *pMsg ) { if( !hServObj ) return false; if( !CSpecialFX::Init( hServObj, pMsg )) return false; m_cs.hServerObj = hServObj; m_cs.Read( pMsg ); ObjectCreateStruct ocs; LTVector vPos; g_pLTClient->GetObjectPos( m_hServerObject, &vPos ); ocs.m_Pos = vPos; ocs.SetFileName(TRIGFX_DIMS_MODEL ); ocs.SetMaterial(0, TRIGFX_DIMS_MATERIAL ); ocs.m_ObjectType = OT_MODEL; ocs.m_Flags = FLAG_NOLIGHT | FLAG_GOTHRUWORLD; m_hDimsObject = g_pLTClient->CreateObject( &ocs ); if( !m_hDimsObject ) return false; LTVector vDims = m_cs.vDims; g_pPhysicsLT->SetObjectDims( m_hDimsObject, &vDims, 0 ); if( NULL != m_cs.hTriggerTypeRecord ) { m_hIcon.Load( TriggerTypeDB::Instance().GetIconTexture(m_cs.hTriggerTypeRecord) ); } return true; }
void CCharacterHitBox::CreateNodeRadiusModels() { AIASSERT( m_pHitBoxUser, m_hObject, "Called with NULL HitBoxUser" ); AIASSERT( m_hModel, m_hObject, "Called with NULL m_hModel" ); AIASSERT( m_hObject, m_hObject, "Called with NULL m_hObject" ); if (!m_hModel) { return; } ModelsDB::HSKELETON hModelSkeleton = m_pHitBoxUser->GetModelSkeleton(); int cNodes = g_pModelsDB->GetSkeletonNumNodes(hModelSkeleton); for (int iNode = 0; iNode < cNodes; iNode++) { ModelsDB::HNODE hCurNode = g_pModelsDB->GetSkeletonNode( hModelSkeleton, iNode ); const char* szNodeName = g_pModelsDB->GetNodeName( hCurNode ); float fNodeRadius = GetNodeRadius( hCurNode ); if (fNodeRadius <= 0.0f) { continue; } if (!szNodeName) { continue; } LTTransform transform; if ( GetNodeTransform(szNodeName, transform ) == false ) { continue; } // Create the radius model... ObjectCreateStruct theStruct; theStruct.m_Pos = transform.m_vPos; theStruct.SetFileName("Models\\sphere." RESEXT_MODEL_PACKED); theStruct.SetMaterial( 0,"Materials\\Grid." RESEXT_MATERIAL ); theStruct.m_Flags = FLAG_VISIBLE; theStruct.m_ObjectType = OT_MODEL; theStruct.m_eGroup = ePhysicsGroup_NonSolid; HCLASS hClass = g_pLTServer->GetClass("BaseClass"); LPBASECLASS pModel = g_pLTServer->CreateObject(hClass, &theStruct); LTASSERT( pModel, "Failed to create BaseClass" ); if (!pModel) { return; } // Don't eat ticks please... ::SetNextUpdate(pModel->m_hObject, UPDATE_NEVER); g_pLTServer->SetObjectScale(pModel->m_hObject, fNodeRadius); NodeRadiusStruct* pNRS = debug_new(NodeRadiusStruct); pNRS->hNode = hCurNode; pNRS->hModel = pModel->m_hObject; // Add the model to our list... m_NodeRadiusList.AddTail(pNRS); } }