
These are the small, high-frequency helpers most games and agents use constantly.
Methods and constants:
lerp(a, b, t)clamp(value, min, max)random()random(max)random(min, max)distance(x1, y1, x2, y2)angle(x1, y1, x2, y2)PITAUAlias helpers:
aura.math.vec2 === aura.vec2aura.math.vec3 === aura.vec3Canonical color helpers:
aura.rgb(r, g, b)aura.rgba(r, g, b, a)aura.Color.REDaura.Color.GREENaura.Color.BLUEaura.Color.WHITEaura.Color.BLACKaura.Color.YELLOWaura.Color.CYANaura.Color.MAGENTAaura.Color.TRANSPARENTCompatibility aliases still seen in older code/docs:
aura.color(...)aura.colors.*New code should prefer rgb, rgba, and Color.*.
Constructor and pure helpers:
aura.vec2(x, y)aura.vec2.add(a, b)aura.vec2.sub(a, b)aura.vec2.scale(v, s)aura.vec2.dot(a, b)aura.vec2.length(v)aura.vec2.normalize(v)aura.vec2.distance(a, b)aura.vec2.lerp(a, b, t)Constructor and pure helpers:
aura.vec3(x, y, z)aura.vec3.add(a, b)aura.vec3.sub(a, b)aura.vec3.scale(v, s)aura.vec3.dot(a, b)aura.vec3.cross(a, b)aura.vec3.length(v)aura.vec3.normalize(v)aura.vec3.distance(a, b)aura.vec3.lerp(a, b, t)Timer/time helpers:
after(delay, callback)every(interval, callback)cancel(timerId)getDelta()getTime()Use cases:
Primitive collision checks:
rectRect(a, b)rectPoint(rect, point)circleCircle(a, b)circlePoint(circle, point)circleRect(circle, rect)Batch helpers:
rectRectBatch(...)rectPointBatch(...)circleCircleBatch(...)circlePointBatch(...)circleRectBatch(...)Use cases:
3D collision helpers:
boxBox(a, b)boxBoxContact(a, b)sphereSphere(a, b)sphereBox(sphere, box)sphereBoxContact(sphere, box)raySphere(ray, sphere)raySphereHit(ray, sphere)rayBox(ray, box)rayBoxHit(ray, box)pointBox(point, box)pointSphere(point, sphere)spherePlane(sphere, plane)rayPlane(ray, plane)rayPlaneHit(ray, plane)rayTriangle(ray, v0, v1, v2)capsuleCapsule(aStart, aEnd, aRadius, bStart, bEnd, bRadius)closestPoint(shape, point)sphereCast(start, end, radius, target)movingBoxBox(a, velocityA, b, velocityB, dt)Return-shape notes:
booleanraySphere(...), rayBox(...),
rayPlane(...), sphereBox(...), and boxBox(...)raySphereHit(...), rayBoxHit(...), rayPlaneHit(...), and
rayTriangle(...) return false on miss or invalid input, or
{ hit: true, t, point, normal } on hitsphereBoxContact(...) and boxBoxContact(...) return false on miss or
invalid input, or { hit: true, depth, point, normal } on hitcapsuleCapsule(...), sphereCast(...), and movingBoxBox(...) return
false on miss or invalid input{ hit: true, toi, point, normal }
where toi is the normalized hit fraction in [0, 1] over the authored
sweep intervalUse cases:
aura.physics3d worldECS-lite helper namespace:
createEntity()removeEntity(entityId)addComponent(entityId, componentName, value)getComponent(entityId, componentName)system(name, fn, order?)run(dt)Notes:
aura.ecs.run(dt) from aura.update(dt).