work on openxr controllers

This commit is contained in:
2026-06-15 03:49:11 +03:00
parent b8aa36ccc0
commit c51080a903
16 changed files with 1030 additions and 75 deletions

View File

@@ -6,7 +6,8 @@
CMOBAPlayer::CMOBAPlayer()
{
m_hCuboid = g_pPhysics->CreateCube({1,1,1});
m_pLeftHand = EntitySystem()->CreateByClassname("player_hand_controller", &m_leftHandId);
m_pRightHand = EntitySystem()->CreateByClassname("player_hand_controller", &m_rightHandId);
}
CMOBAPlayer::~CMOBAPlayer()
@@ -20,6 +21,9 @@ void CMOBAPlayer::Spawn()
SetModel("game/core/models/sphere.fmdl");
SetAbsOrigin({0,-11.5, 0});
SetThink(Think);
m_pLeftHand->Spawn();
m_pRightHand->Spawn();
};
bool CMOBAPlayer::CheckMask( HCollider hCollider )
@@ -52,8 +56,36 @@ BEGIN_DATADESC(CMOBAPlayer)
END_DATADESC()
IMPLEMENT_SEND_DT(CMOBAPlayer)
NetPropInt(m_leftHandId),
NetPropInt(m_rightHandId),
END_SEND_DT()
IMPLEMENT_RECV_DT(CMOBAPlayer)
NetPropFloat3(m_vMovementVector)
NetPropFloat3(m_vMovementVector),
END_RECV_DT()
CMOBAPlayerHandController::CMOBAPlayerHandController()
{
}
void CMOBAPlayerHandController::Spawn()
{
CBaseEntity::Spawn();
SetModel("game/core/models/sphere.fmdl");
SetScale(0.03);
SetThink(Think);
}
void CMOBAPlayerHandController::Think( float fDelta )
{
}
LINK_ENTITY_TO_CLASS(player_hand_controller, CMOBAPlayerHandController)
BEGIN_DATADESC(CMOBAPlayerHandController)
END_DATADESC()
IMPLEMENT_SEND_DT(CMOBAPlayerHandController)
END_SEND_DT()
IMPLEMENT_RECV_DT(CMOBAPlayerHandController)
END_RECV_DT()

View File

@@ -20,6 +20,22 @@ private:
Vector m_vMovementVector = {};
HShape m_hCuboid = NULL;
CBaseEntity *m_pLeftHand;
int m_leftHandId;
CBaseEntity *m_pRightHand;
int m_rightHandId;
};
class CMOBAPlayerHandController: public CBaseModelEntity
{
public:
DECLARE_CLASS(CMOBAPlayerHandController, CBaseModelEntity);
DECLARE_DATADESC();
DECLARE_SERVERCLASS()
CMOBAPlayerHandController();
virtual void Spawn( void ) override;
void Think( float fDelta );
};
#endif