Physics

The static global Physics class allows you cast shapes to find a Object and change the gravity. For example, Physics.setGravity({0, -20, 0}).

Functions

Return ValueFunction NameDescription
Tablecast(Table Info)Casts a shape based on Info and returns a table of multiple Hit.

Info

TypeNameDescription
VectororiginThe start point of the cast.
VectordirectionThe direction of the cast.
inttypeThe type of cast. 1 = Ray, 2 = Sphere, 3 = Box.
VectorsizeThe size of the cast. Only used for Sphere and Box.
VectororientationThe rotation of the cast. Only used for Box.
floatmax_distanceThe distance the ray will cast. If not supplied it will be infinity.
booldebugVisualize the cast with this debug bool set to true.

Hit

TypeNameDescription
VectorpointThe position the cast impact.
VectornormalThe surface normal of the impact point.
floatdistanceThe distance between the cast origin and the impact point.
Objecthit_objectThe object hit by the cast.
Vector
getGravity()Returns the gravity Vector.
boolsetGravity(Vector
)
Sets the gravity Vector.