working physics
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user