improve rendering and physics

This commit is contained in:
2026-03-18 18:41:28 +02:00
parent 0a506f7185
commit b56d85f95d
33 changed files with 141 additions and 82 deletions

View File

@@ -7,13 +7,18 @@
void CMOBAPlayer::Spawn()
{
CBaseEntity::Spawn();
SetModel("game/core/models/cube.fmdl");
SetPhysics(k_EPhysics_Static);
SetModel("game/core/models/sphere.fmdl");
SetScale(1);
SetAbsOrigin({0,-14.5, 0});
SetThink(Think);
};
void CMOBAPlayer::Think( float fDelta )
{
BaseClass::Think(fDelta);
Vector vPosition = GetAbsOrigin();
// player might lie to us
m_vMovementVector.x = glm_clamp(m_vMovementVector.x, -1, 1);
@@ -22,7 +27,6 @@ void CMOBAPlayer::Think( float fDelta )
vPosition.x += m_vMovementVector.x*fDelta*5;
vPosition.z += m_vMovementVector.z*fDelta*5;
SetAbsOrigin(vPosition);
V_printf("player: %f %f %f\n", vPosition.x, vPosition.y, vPosition.z);
};
LINK_ENTITY_TO_CLASS(player, CMOBAPlayer)

View File

@@ -3,10 +3,10 @@
#include "physicsprop.h"
class CMOBAPlayer: public CBaseModelEntity
class CMOBAPlayer: public CPhysicsProp
{
public:
DECLARE_CLASS(CMOBAPlayer, CBaseModelEntity);
DECLARE_CLASS(CMOBAPlayer, CPhysicsProp);
DECLARE_DATADESC();
DECLARE_SERVERCLASS()