Facepunch / garrysmod-requests

Feature requests for Garry's Mod
86 stars 24 forks source link

Function/Hook to pause physics #2541

Open wrefgtzweve opened 10 hours ago

wrefgtzweve commented 10 hours ago

It seems like there's already functionality for it in the engine. Seems relatively straight forward to add, could be either a hook or a function eg. physenv.Enable() physenv.Disable() physenv.Status() physenv.Toggle() or hook.Add( "PhysenvShouldSimulate",

Engine code: PhysFrame https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/server/physics.cpp#L1676-L1677 Image g_PhysicsHook.ShouldSimulate https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/server/physics.cpp#L134-L137 Image

Being able to "pause" physics would be pretty useful for when there's server lag, you could even theoretically only run physics once every 2 ticks for example.