Physics Helpers

Various functions to make dealing with the HL2 physics engine a little easier.

Summary
Physics HelpersVarious functions to make dealing with the HL2 physics engine a little easier.
Functions
applyAccel
applyForce
applyAccelInCurDirectionApplies an acceleration in the entities current velocity direction ( not the entity’s heading ).
applyForceInCurDirectionApplies a force in the entities current velocity direction ( not the entity’s heading ).

Functions

applyAccel

function ULib.applyAccel(ent,
magnitude,
direction,
dTime)

Parameters

entThe entity to apply the acceleration to
magnitudeThe amount of acceleration ( Use nil if the magnitude is specified in the direction )
directionThe direction to apply the acceleration in ( if the magnitude is part of the direction, specify nil for the magnitude )
dTime(Optional, defaults to 1) The time passed since the last update in seconds ( IE: 0.5 for dTime would only apply half the acceleration )

applyForce

function ULib.applyForce(ent,
magnitude,
direction,
dTime)

Parameters

entThe entity to apply the force to
magnitudeThe amount of force ( Use nil if the magnitude is specified in the direction )
directionThe direction to apply the force in ( if the magnitude is part of the direction, specify nil for the magnitude )
dTime(Optional, defaults to 1) The time passed since the last update in seconds ( IE: 0.5 for dTime would only apply half the force )

applyAccelInCurDirection

function ULib.applyAccelInCurDirection(ent,
magnitude,
dTime)

Applies an acceleration in the entities current velocity direction ( not the entity’s heading ).  See applyAccel.  Basically makes the entity go faster or slower ( if a negative magnitude is passed ).

Parameters

entThe entity to apply the force to
magnitudeThe amount of acceleration
dTime(Optional, defaults to 1) The time passed since the last update in seconds ( IE: 0.5 for dTime would only apply half the acceleration )

applyForceInCurDirection

function ULib.applyForceInCurDirection(ent,
magnitude,
dTime)

Applies a force in the entities current velocity direction ( not the entity’s heading ).  See applyForce.  Basically makes the entity go faster or slower ( if a negative magnitude is passed ).

Parameters

entThe entity to apply the force to
magnitudeThe amount of force
dTime(Optional, defaults to 1) The time passed since the last update in seconds ( IE: 0.5 for dTime would only apply half the force )
function ULib.applyAccel(ent,
magnitude,
direction,
dTime)
function ULib.applyForce(ent,
magnitude,
direction,
dTime)
function ULib.applyAccelInCurDirection(ent,
magnitude,
dTime)
Applies an acceleration in the entities current velocity direction ( not the entity’s heading ).
function ULib.applyForceInCurDirection(ent,
magnitude,
dTime)
Applies a force in the entities current velocity direction ( not the entity’s heading ).
Close