Core3D

Builds the 3D scene for a game, with objects that move, collide and fall. Ask for a 3D game, for example bowling or a maze you roll a ball through.

Utilities & Storage

Asset stores, saved data, and the core building blocks behind bigger experiences.

Made with this block

Functions

Object3DObject

Object3D class constructor. Base class for every node in the scene graph (cameras, lights, meshes, scenes). Holds position/rotation/scale and child Object3Ds. Use directly as an empty pivot/group, or extend.

SceneObject

Scene class constructor. Root of every 3D world; creates its own render layer and physics world. Extends Object3D.

PerspectiveCameraObject

PerspectiveCamera class constructor. Extends Object3D. Renders along its local -Z axis. Set cam.target to point it at a world position.

AmbientLightObject

AmbientLight class constructor. Uniform light from all directions. Extends Object3D.

DirectionalLightObject

DirectionalLight class constructor. Auto-positioned shadow frustum; supports both projective and shadow-map shadows. Emits along local -Z. Extends Object3D.

PointLightObject

PointLight class constructor. Omnidirectional point light with distance falloff. Extends DistanceDecayLight (which extends Object3D).

SpotLightObject

SpotLight class constructor. Cone-shaped light; supports shadows (shadow-map technique only). Emits along local +Z. Extends DistanceDecayLight (which extends Object3D).

EnvironmentMapObject

EnvironmentMap class constructor. Image-based lighting (IBL); ships with default diffuse/specular textures.

SphereGeometryObject

SphereGeometry class constructor. Centered at origin, poles along Y.

BoxGeometryObject

BoxGeometry class constructor. Centered at origin: width=X, height=Y, depth=Z.

PlaneGeometryObject

PlaneGeometry class constructor. Lies flat in the XZ plane facing +Y; do NOT rotate to flatten. Centered at origin.

RoundedBoxGeometryObject

RoundedBoxGeometry class constructor. Box with rounded edges/corners. Centered at origin.

CylinderGeometryObject

CylinderGeometry class constructor. Centered at origin; height along Y, circular cross-section in XZ.

ConeGeometryObject

ConeGeometry class constructor. Shorthand for CylinderGeometry with radiusTop=0. Apex at +Y.

CapsuleGeometryObject

CapsuleGeometry class constructor. Centered at origin; length along Y, hemispherical caps at +Y and -Y.

TorusGeometryObject

TorusGeometry class constructor. Ring in the XZ plane, hole axis along Y.

TetrahedronGeometryObject

TetrahedronGeometry class constructor. Centered at origin.

OctahedronGeometryObject

OctahedronGeometry class constructor. Centered at origin.

IcosahedronGeometryObject

IcosahedronGeometry class constructor. Centered at origin.

DodecahedronGeometryObject

DodecahedronGeometry class constructor. Centered at origin.

CircleGeometryObject

CircleGeometry class constructor. Flat disc in the XZ plane, +Y normal. Centered at origin.

RingGeometryObject

RingGeometry class constructor. Flat annulus in the XZ plane, +Y normal.

LatheGeometryObject

LatheGeometry class constructor. Surface of revolution around Y. `points` are vec2 with x = distance from Y, y = height.

TubeGeometryObject

TubeGeometry class constructor. Tube extruded along a Catmull-Rom spline through waypoints.

ExtrudeGeometryObject

ExtrudeGeometry class constructor. Extrudes a closed 2D polygon along +Y. No bevel, no holes.

BufferGeometryObject

BufferGeometry class constructor. Custom mesh from raw arrays: chain setPositions()/setIndices() (optionally setUVs()/setNormals()) and call build() to finalize. Normals are auto-computed if omitted.

HeightfieldGeometryObject

HeightfieldGeometry class constructor. Procedural plane in XZ centered at origin with Y derived from a height function. Defaults to non-convex collision (use with a static Mesh).

ExternalGeometryObject

ExternalGeometry class constructor. Wraps a native Lens Studio mesh asset (e.g. obtained via core3d.loadModel()).

AABBObject

AABB class constructor. Axis-aligned bounding box defined by two vec3 corners.

PBRMaterialObject

PBRMaterial class constructor. Physically based material with baseColor / metallic / roughness / emissive / textures.

UnlitMaterialObject

UnlitMaterial class constructor. Ignores scene lighting; renders a flat color or texture.

ToonMaterialObject

ToonMaterial class constructor. Stylized toon-shaded material.

ExternalMaterialObject

ExternalMaterial class constructor. Wraps a native Lens Studio Material asset (e.g. attached to a mesh imported via core3d.loadModel()). Call .toPBR() to convert.

MeshObject

Mesh class constructor. The renderable 3D object: geometry + material. Extends Object3D. Set physical=true to enable physics, dynamic=true for force-driven motion.

RayObject

Ray class constructor. Mutable origin + direction holder used by Raycaster.

RaycasterObject

Raycaster class constructor. Performs ray and sphere-sweep scene intersection queries against physical meshes.

loadModelObject

Import a 3D model prefab (e.g. GLB) preserving its hierarchy. Nodes with geometry become Mesh, container-only nodes become Object3D wrappers. Returns null if `prefab` is null.

createPointJointObject

Create a point (ball-and-socket) joint between two physical meshes (or one mesh and the world). Pass meshB=null to anchor to the world. Auto-disables collisions between the two bodies.

createHingeJointObject

Create a hinge joint with a single rotation axis. Pass meshB=null to anchor to the world. Returns a HingeJoint with motor + limit controls. Auto-disables collisions between the two bodies.

createFixedJointObject

Weld two physical meshes together at their current relative pose. Auto-disables collisions between the two bodies.

removeJointvoid

Remove a joint previously created by createPointJoint / createHingeJoint / createFixedJoint. No-op on null.

ignoreCollisionvoid

Disable collisions between two physical meshes. Symmetric. Safe to call repeatedly.

restoreCollisionvoid

Re-enable collisions previously disabled with ignoreCollision. Symmetric.

ignoreCollisionsAmongvoid

Disable collisions among every unordered pair in the given mesh list. Useful for groups (e.g. claw fingers) that should still collide with the world but pass through each other.

OcclusionMaterialObject

OcclusionMaterial class constructor. Depth-only occluder: writes depth but no color, so virtual content behind it is hidden. Put it on a Mesh built from a world-facing camera's world.geometry to occlude virtual objects with the real environment, or on any geometry for a manual occluder volume.

WorldDebugMaterialObject

WorldDebugMaterial class constructor. Renders the world mesh visibly for debugging (a tinted overlay of the scanned surfaces). Put it on a Mesh built from world.geometry.

ShadowMaterialObject

ShadowMaterial class constructor. Transparent shadow catcher: invisible except where a shadow falls. Put it on a Mesh built from world.geometry with shadowMode='receive' so virtual content casts grounding shadows onto the real world.

WorldObject

World class constructor: new core3d.World(camera). World understanding for a world-facing camera — surface raycasts (hitTest/raycast/probe), vacant-surface finders (findFloor/findWall/findTable/findSurface), the live world mesh (world.geometry, pair with OcclusionMaterial/ShadowMaterial), anchors (world.anchor) and plane events (world.onPlaneAdded/onReset). Singleton: returns the existing instance if one was already created. Constructing it auto-enables the camera's deviceTracking. The instance methods/properties are documented in the Core3D API reference.

InstancedMeshObject

InstancedMesh class constructor. Renders MANY copies of one geometry + material in a single draw call (GPU instancing) — use for dozens to thousands of repeated shapes (forests, crowds, debris, grids) instead of many Mesh objects. Extends Object3D; instance transforms are local to the object, so moving/rotating/parenting it moves the whole set. Manage copies with addInstance(position?, rotation?, scale?) or addInstance(mat4) returning a stable id (-1 when full), removeInstance(id), per-instance accessors set/getPositionAt, set/getRotationAt, set/getQuaternionAt, set/getScaleAt, set/getMatrixAt(id, mat4), set/getColorAt(id, vec4), and count. Render-only: no shadows, no per-instance physics or raycast. The instance methods are documented in the Core3D API reference.

InstancedPBRMaterialObject

InstancedPBRMaterial class constructor. For InstancedMesh ONLY: the PBRMaterial look (baseColor/metallic/roughness/emissive/textures) with instancing + per-instance color via instancedMesh.setColorAt. Same properties as PBRMaterial. Cannot be used on a regular Mesh.

InstancedUnlitMaterialObject

InstancedUnlitMaterial class constructor. For InstancedMesh ONLY: the UnlitMaterial look (flat color/texture, ignores lighting) with instancing + per-instance color via instancedMesh.setColorAt. Same properties as UnlitMaterial. Cannot be used on a regular Mesh.

RibbonGeometryObject

RibbonGeometry class constructor: new core3d.RibbonGeometry(pathOrCurve, tubularSegments, width, widthSegments, closed, options). Curved surface generated along a smooth 3D midrib path, with width tapering along the path plus optional twist, curl, normal offset and profile override — leaf blades, palm fronds, flags, fins, wings, feathers, strips of cloth. options: { twist=0, curl=0, normalOffset=0, profile=null, uvMode="length" }; twist, curl and normalOffset each accept a number, a number array or a function of t. Ribbons are single-sided surfaces — set material.doubleSided = true to see both faces.

TaperedTubeGeometryObject

TaperedTubeGeometry class constructor: new core3d.TaperedTubeGeometry(pathOrCurve, tubularSegments, radius, radialSegments, closed, options). Tube extruded along a smooth 3D path whose radius varies along the path — trunks, horns, tentacles, tapering pipes. IMPORTANT: the argument order differs from TubeGeometry — it is (path, tubularSegments, radius, ...) here, NOT TubeGeometry's (path, radius, tubularSegments, ...). options: { capStart=true, capEnd=true, radiusScale=1, uvMode="length" }; use uvMode="normalized" for evenly spaced U by segment index.

TextGeometryObject

TextGeometry class constructor: new core3d.TextGeometry(text, options). 3D extruded text as a real merged mesh — feed it to a standard Mesh and it composes with materials, physics, shadows and raycasting like any other geometry. The geometry and its AABB are ready synchronously as soon as the constructor returns. options: { size (cap height in world units, default 10), depth (extrusion, default 0.28*size), font ("bold" | "headline" | "playful" | "handwritten"; omit for the default font), align ("center" default — origin at the text centre, the AR-label-friendly pivot; or "left" for the native layout origin), weight (100-900), italic, letterSpacing, lineSpacing }. For per-letter effects (tumbling letters, per-letter colour) build one TextGeometry per character — a single geometry has no per-glyph handles. Physics: the default collider is a convex hull, so glyph holes are filled and a whole string collides as one slab; set geometry.collisionConvex = false with dynamic = false for a concave static collider.