Functions under Dreams.Lib.*
Intersections
Lib.IntersectABCylinderWithAABB
(cylOrg: Vector, cylRadius: float, cylHeight: float, boxmin: Vector, boxmax: Vector)
Calculates if an axis-bound cylinder is within an AABB container
Returns result: bool
, normal: Vector
, penetration-dist: Vector
- Origin starts the bottom of the cylinder, easier for player collisions
Lib.IntersectSphereWithAABB
(sphereOrg: Vector, radius: float, boxmin: Vector, boxmax: Vector)
Calculates if a sphere is within an AABB container
Returns result: bool
, normal: Vector
, penetration-dist: Vector
Lib.IntersectABCylinderWithOBB
(cylOrg: Vector, cylRadius: float, cylHeight: float, boxorg: Vector, boxangle: Angle, boxmin: Vector, boxmax: Vector, sizex: int, sizey: int, sizez: int)
Calculates if an axis-bound cylinder is within an OBB container sizex
, sizey
, sizez
are the Half-Extents of the OBB container Returns result: bool
, normal: Vector
, penetration-dist: Vector
- Origin starts the bottom of the cylinder, easier for player collisions
Lib.IntersectSphereWithOBB
(sphereOrg: Vector, radius: float, boxorg: Vector, boxangle: Angle, boxmin: Vector, boxmax: Vector)
Calculates if a sphere is within an OBB container
Returns result: bool
, normal: Vector
, penetration-dist: Vector
Vector Math
Lib.PlaneToNormal
(p1: Vector, p2: Vector, p3: Vector)
Returns normal: Vector
from three points defining a plane
Lib.InsideOutTest
(p1: Vector, p2: Vector, p3: Vector, inside_point: Vector)
Returns result: bool
whether inside_point
is on the same side as p3
of the line defined by p1
and p2
Lib.RotationMatrixFromNormals
(normal1: Vector, normal2: Vector, normal3: Vector)
Returns a rotational matrix: VMatrix
from three orthogonal normals
Lib.MinMaxVecs
(min, max, vector)
Returns a new min: Vector, max: Vector
set with vector
included
Lib.HalfExtentsFromBox
(min, max)
Returns a table {1 = x, 2 = y, 3 = z}
with the half extents of each axes
Lib.IsSquare
(verts: table)
Returns result: bool
if a table of verts on a plane form a square
Lib.MagnitudeToNormal
(xdelta: float, ydelta: float, zdelta: float)
Returns the normal: Vector
facing the direction of the axis of the highest magnitude
Used by Cylinder and Sphere intersections
delta
variables use their absolute value internally
Lib.RectToMeshEx
(l, w, h, origin: Vector, [ignore: table, reverse_faces: bool, utex_add, vtex_add])
Creates a rectangle for rendering meshes, origin
starts in the left corner
DreamPhys Traces
Lib.TraceRayPhys
(phys: DreamPhys, start: Vector, dir: Vector, dist)
Performs a trace on a DreamPhys object
Returns bool: hit
, fraction
, Vector: hitnormal
, DreamSolid: hitsolid
, DreamSide: hitside
Lib.IntersectCylPhys
(phys: DreamPhys, origin: Vector, rad, height)
Performs a Cylinder intersection on a DreamPhys object
Returns Vector: hitnormal
, Vector: dist
, DreamSolid: hitsolid