improved physics, added better caching

This commit is contained in:
2025-06-05 22:02:53 +03:00
parent 5d85ebd85f
commit 64c0f41884
36 changed files with 651 additions and 106 deletions

View File

@@ -1,4 +1,22 @@
#include "baseentity.h"
#include "cglm/affine-pre.h"
#include "cglm/mat4.h"
#include "physics.h"
class CBasePlayer: public CBaseEntity
{
public:
virtual void Precache ( void ) override;
virtual void Spawn( void ) override;
virtual void ReadParameter( const char *szName, const char *szValue ) override;
virtual void Destroy( void ) override;
virtual void Think( float fDelta ) override;
CPxBoxMesh m_Collider;
CPxRigidBody m_RigidBody;
};
class C_BasePlayer: public C_BaseEntity
{
@@ -10,6 +28,9 @@ public:
};
extern mat4 g_cameraView;
void C_BasePlayer::Precache()
{
@@ -17,7 +38,6 @@ void C_BasePlayer::Precache()
void C_BasePlayer::Spawn()
{
};
void C_BasePlayer::Destroy()
@@ -26,6 +46,9 @@ void C_BasePlayer::Destroy()
}
void C_BasePlayer::Think( float fDelta )
{
CBasePlayer *pPlayer = (CBasePlayer*)pEntity;
glm_mat4_identity(g_cameraView);
V_memcpy(&g_cameraView[3][0], pPlayer->m_RigidBody.GetPosition().m, 12);
};