buildMatrix(pos, rotation, scale, matrix) → Matrix4math3d.js:589Build 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:589Build a transform for an object from its position, rotation and scale
collideBoxBox3D(posA, sizeA, posB, sizeB, rotationA, rotationB) → Vector3|undefinedmath3d.js:872Returns 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:771Returns the vector to move a sphere out of a box, or undefined
collideSphereCylinder(pos, radius, cylinderPos, cylinderRadius, cylinderHeight) → Vector3|undefinedmath3d.js:832Returns the vector to move a sphere out of a vertical cylinder, or undefined
collideSphereInBox(pos, radius, boxPos, boxSize) → Vector3|undefinedmath3d.js:800Returns 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:749Returns 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:730Check if two boxes are overlapping, touching edges do not overlap
isPointInBox3D(point, pos, size, rotation) → booleanmath3d.js:710Check if a point is inside a box, boundary is inclusive
randInSphere(radius, minRadius) → Vector3math3d.js:59Returns 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:45Returns 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:982Returns the distance along the ray to the first intersection with a box, or undefined
raycastPlane(ray, planePos, planeNormal) → number|undefinedmath3d.js:961Returns the distance along the ray to a plane, or undefined if parallel or behind
raycastSphere(ray, pos, radius) → number|undefinedmath3d.js:933Returns 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