buildMatrix(pos, rotation, scale, matrix) → Matrix4math3d.js:597Build a transform for an object from its position, rotation and scale
- A point is scaled first, then rotated, then moved, which is what you want for a game object
LittleJS 3D Math Plugin
buildMatrix(pos, rotation, scale, matrix) → Matrix4math3d.js:597Build a transform for an object from its position, rotation and scale
collideBoxBox3D(posA, sizeA, posB, sizeB, rotationA, rotationB) → Vector3|undefinedmath3d.js:880Returns the vector to move box A by so it no longer overlaps box B, the shortest way out, or undefined
collideSphereBox(pos, radius, boxPos, boxSize, boxRotation) → Vector3|undefinedmath3d.js:779Returns the vector to move a sphere out of a box, or undefined
collideSphereCylinder(pos, radius, cylinderPos, cylinderRadius, cylinderHeight) → Vector3|undefinedmath3d.js:840Returns the vector to move a sphere out of a vertical cylinder, or undefined
collideSphereInBox(pos, radius, boxPos, boxSize) → Vector3|undefinedmath3d.js:808Returns the vector to move a sphere back inside an axis aligned box, or undefined when it is all inside
collideSphereSphere(posA, radiusA, posB, radiusB) → Vector3|undefinedmath3d.js:757Returns the vector to move sphere A by so it no longer overlaps sphere B, or undefined
isOverlapping3D(posA, sizeA, posB, sizeB, rotationA, rotationB) → booleanmath3d.js:738Check if two boxes are overlapping, touching edges do not overlap
isPointInBox3D(point, pos, size, rotation) → booleanmath3d.js:718Check if a point is inside a box, boundary is inclusive
isVector3(v) → v is Vector3math3d.js:35Check if the object is a valid Vector3, a type guard in TypeScript
v anyrandInSphere(radius, minRadius) → Vector3math3d.js:61Returns a random Vector3 inside a sphere, spread evenly through its volume, the 3D twin of randInCircle
radius number optional, default 1minRadius number optional, default 0Leave a hollow middle this big
randVector3(length, coneAngle) → Vector3math3d.js:47Returns a random Vector3 of a given length, pointing any direction evenly, or within a cone around +Y
length number optional, default 1coneAngle number optionalHalf angle of the cone around +Y in radians, PI is every direction
raycastBox(ray, pos, size, rotation) → number|undefinedmath3d.js:990Returns the distance along the ray to the first intersection with a box, or undefined
raycastPlane(ray, planePos, planeNormal) → number|undefinedmath3d.js:969Returns the distance along the ray to a plane, or undefined if parallel or behind
raycastSphere(ray, pos, radius) → number|undefinedmath3d.js:941Returns the distance along the ray to the first intersection with a sphere, or undefined
vec3(x, y, z) → Vector3math3d.js:22Create a 3D vector, can take 0, 1, 2 or 3 numbers
x number optional, default 0y number optionalz number optional