void PhysicsLevelInit( void ) { physenv = physics->CreateEnvironment(); assert( physenv ); #ifdef PORTAL physenv_main = physenv; #endif { MEM_ALLOC_CREDIT(); g_EntityCollisionHash = physics->CreateObjectPairHash(); } // TODO: need to get the right factory function here //physenv->SetDebugOverlay( appSystemFactory ); physenv->SetGravity( Vector(0, 0, -sv_gravity.GetFloat() ) ); physenv->SetAlternateGravity( Vector(0, 0, -cl_ragdoll_gravity.GetFloat() ) ); // NOTE: Always run client physics at a rate >= 45Hz - helps keep ragdolls stable const float defaultPhysicsTick = 1.0f / 60.0f; // 60Hz to stay in sync with x360 framerate of 30Hz physenv->SetSimulationTimestep( defaultPhysicsTick ); physenv->SetCollisionEventHandler( &g_Collisions ); physenv->SetCollisionSolver( &g_Collisions ); C_World *pWorld = GetClientWorldEntity(); g_PhysWorldObject = PhysCreateWorld_Shared( pWorld, modelinfo->GetVCollide(1), g_PhysDefaultObjectParams ); staticpropmgr->CreateVPhysicsRepresentations( physenv, &g_SolidSetup, pWorld ); }
void PhysicsLevelInit( void ) { physenv = physics->CreateEnvironment(); assert( physenv ); #ifdef PORTAL physenv_main = physenv; #endif { MEM_ALLOC_CREDIT(); g_EntityCollisionHash = physics->CreateObjectPairHash(); } // TODO: need to get the right factory function here //physenv->SetDebugOverlay( appSystemFactory ); physenv->SetGravity( Vector(0, 0, -sv_gravity.GetFloat() ) ); // 15 ms per tick // NOTE: Always run client physics at this rate - helps keep ragdolls stable physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : DEFAULT_TICK_INTERVAL ); physenv->SetCollisionEventHandler( &g_Collisions ); physenv->SetCollisionSolver( &g_Collisions ); g_PhysWorldObject = PhysCreateWorld_Shared( GetClientWorldEntity(), modelinfo->GetVCollide(1), g_PhysDefaultObjectParams ); staticpropmgr->CreateVPhysicsRepresentations( physenv, &g_SolidSetup, NULL ); }
void CWorldDimsProxy::OnBind( void *pC_BaseEntity ) { if ( m_pMinsVar && m_pMaxsVar ) { C_World *pWorld = GetClientWorldEntity(); if ( pWorld ) { m_pMinsVar->SetVecValue( (const float*)&pWorld->m_WorldMins, 3 ); m_pMaxsVar->SetVecValue( (const float*)&pWorld->m_WorldMaxs, 3 ); } } }
void CWorldDimsProxy::OnBind( void *pC_BaseEntity ) { if ( m_pMinsVar && m_pMaxsVar ) { C_World *pWorld = GetClientWorldEntity(); if ( pWorld ) { m_pMinsVar->SetVecValue( (const float*)&pWorld->m_WorldMins, 3 ); m_pMaxsVar->SetVecValue( (const float*)&pWorld->m_WorldMaxs, 3 ); } } if ( ToolsEnabled() ) { ToolFramework_RecordMaterialParams( GetMaterial() ); } }