HolyLib Wiki

HolyLib:PrePhysFrame

  boolean HolyLib:PrePhysFrame( number deltaTime )

Description

Called when the physics are about to be simulated.

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

Recently Changed

This was recently changed in version (0.8 - DEV).

This previously was HolyLib:OnPhysFrame but was split into HolyLib:PrePhysFrame and HolyLib:PostPhysFrame

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:PrePhysFrame", "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)