#include "physicsprop.h" #include "game.h" void CPhysicsProp::Precache() { } void CPhysicsProp::Spawn() { CBaseEntity::Spawn(); SetThink(Think); } void CPhysicsProp::Think( float fDelta ) { BaseClass::SetAbsOrigin(m_pBody->GetPosition()); BaseClass::SetAbsAngles(m_pBody->GetRotation()); } void CPhysicsProp::SetAbsAngles( Quat vQuat ) { BaseClass::SetAbsAngles( vQuat ); if (m_pBody) m_pBody->SetRotation(m_pBody->GetRotation()); } void CPhysicsProp::SetAbsQAngles( float fPitch, float fYaw, float fRoll ) { BaseClass::SetAbsQAngles( fPitch, fYaw, fRoll); if (m_pBody) m_pBody->SetRotation(m_pBody->GetRotation()); } void CPhysicsProp::SetAbsOrigin( Vector origin ) { BaseClass::SetAbsOrigin( origin ); if (m_pBody) m_pBody->SetPosition(m_pBody->GetPosition()); } void CPhysicsProp::SetModel( const char *szName ) { if (m_hModel) { g_pAssetManager->UnrefModel(m_hModel); } m_hModel = g_pAssetManager->LoadModel(szName); m_pModel = g_pAssetManager->GetModelByIndex(m_hModel); m_pPhysics = g_pAssetManager->GetPhysicsByIndex(m_pModel->m_hPhysics); m_hCollider = g_pPhysics->CreateCollider(m_pPhysics->m_hShape); m_pBody = g_pPhysicsWorld->CreateRigidBody(m_hCollider, k_EPhysics_Dynamic); } void CPhysicsProp::EnableMovement() { } void CPhysicsProp::DisableMovement() { }