improve rendering and physics
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user