better physics
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include "physicsprop.h"
|
||||
#include "game.h"
|
||||
|
||||
|
||||
void CPhysicsProp::Precache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CPhysicsProp::Spawn()
|
||||
{
|
||||
SetThink(Think);
|
||||
}
|
||||
|
||||
void CPhysicsProp::Think( float fDelta )
|
||||
{
|
||||
SetAbsOrigin(m_pBody->GetPosition());
|
||||
SetAbsAngles(m_pBody->GetRotation());
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user