HolyLib Wiki

HolyLib:OnPhysFrame

  boolean HolyLib:OnPhysFrame( number deltaTime )

Description

Called when the physics are about to be simulated.

This hook first needs to be enabled by calling physenv.EnablePhysHook(true)

Arguments

1number deltaTime

Returns

1boolean cancel = false
Return true to stop the engine from doing anything.

Example

pausing the physics simulation while still allowing the entities to be updated and moved with the physgun
physenv.EnablePhysHook(true) local mainEnv = physenv.GetActiveEnvironmentByIndex(0) hook.Add("HolyLib:OnPhysFrame", "Example", function(deltaTime) mainEnv:Simulate(deltaTime, true) -- the second argument will only cause the entities to update. return true -- We stop the engine from running the simulation itself again as else it will result in issue like "Reset physics clock" being spammed end)