working physics

This commit is contained in:
2026-03-04 00:18:56 +02:00
parent 02898d62c0
commit 9884006888
12 changed files with 462 additions and 53 deletions

View File

@@ -6,6 +6,7 @@
#include "inetworkserver.h"
#include "netprotocol.h"
#include "tier1/utlvector.h"
#include "iphysics.h"
#ifdef STEAM
#include "steam/isteamgameserver.h"
#include "steam/steam_gameserver.h"
@@ -22,6 +23,9 @@ INetworkBase *g_pClientBridge;
INetworkBase *g_pPublicConnection;
INetworkBase *g_pCurrentConnection;
IPhysics *g_pPhysics;
IPhysicsWorld *g_pPhysicsWorld;
class CFunnyGameBridge: public IEngineBridge
{
virtual void Init() override;
@@ -115,8 +119,13 @@ void CFunnyGameBridge::Init()
#endif
m_fNetUpdateTimer = 0;
CreateInterfaceFn fnPhysicsFactory = Sys_GetFactory("RapierPhysics");
g_pPhysics = (IPhysics*)fnPhysicsFactory(PHYSICS_INTERFACE_VERSION, NULL);
g_pPhysicsWorld = g_pPhysics->CreateWorld();
}
void CFunnyGameBridge::Tick( float fDelta )
{
@@ -183,9 +192,10 @@ void CFunnyGameBridge::Frame( float fDelta )
while (m_fNetUpdateTimer >= fTickRate)
{
m_fNetUpdateTimer-=fTickRate;
EntitySystem()->Think();
if (g_pCurrentConnection)
{
g_pPhysicsWorld->Frame(fTickRate);
EntitySystem()->Think();
EntitySystem()->NetThink(g_pCurrentConnection);
}
}