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.
Asset stores, saved data, and the core building blocks behind bigger experiences.
Made with this blockFunctions
Object3DObjectObject3D 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.
SceneObjectScene class constructor. Root of every 3D world; creates its own render layer and physics world. Extends Object3D.
PerspectiveCameraObjectPerspectiveCamera class constructor. Extends Object3D. Renders along its local -Z axis. Set cam.target to point it at a world position.
AmbientLightObjectAmbientLight class constructor. Uniform light from all directions. Extends Object3D.
DirectionalLightObjectDirectionalLight class constructor. Auto-positioned shadow frustum; supports both projective and shadow-map shadows. Emits along local -Z. Extends Object3D.
PointLightObjectPointLight class constructor. Omnidirectional point light with distance falloff. Extends DistanceDecayLight (which extends Object3D).
SpotLightObjectSpotLight class constructor. Cone-shaped light; supports shadows (shadow-map technique only). Emits along local +Z. Extends DistanceDecayLight (which extends Object3D).
EnvironmentMapObjectEnvironmentMap class constructor. Image-based lighting (IBL); ships with default diffuse/specular textures.
SphereGeometryObjectSphereGeometry class constructor. Centered at origin, poles along Y.
BoxGeometryObjectBoxGeometry class constructor. Centered at origin: width=X, height=Y, depth=Z.
PlaneGeometryObjectPlaneGeometry class constructor. Lies flat in the XZ plane facing +Y; do NOT rotate to flatten. Centered at origin.
RoundedBoxGeometryObjectRoundedBoxGeometry class constructor. Box with rounded edges/corners. Centered at origin.
CylinderGeometryObjectCylinderGeometry class constructor. Centered at origin; height along Y, circular cross-section in XZ.
ConeGeometryObjectConeGeometry class constructor. Shorthand for CylinderGeometry with radiusTop=0. Apex at +Y.
CapsuleGeometryObjectCapsuleGeometry class constructor. Centered at origin; length along Y, hemispherical caps at +Y and -Y.
TorusGeometryObjectTorusGeometry class constructor. Ring in the XZ plane, hole axis along Y.
TetrahedronGeometryObjectTetrahedronGeometry class constructor. Centered at origin.
OctahedronGeometryObjectOctahedronGeometry class constructor. Centered at origin.
IcosahedronGeometryObjectIcosahedronGeometry class constructor. Centered at origin.
DodecahedronGeometryObjectDodecahedronGeometry class constructor. Centered at origin.
CircleGeometryObjectCircleGeometry class constructor. Flat disc in the XZ plane, +Y normal. Centered at origin.
RingGeometryObjectRingGeometry class constructor. Flat annulus in the XZ plane, +Y normal.
LatheGeometryObjectLatheGeometry class constructor. Surface of revolution around Y. `points` are vec2 with x = distance from Y, y = height.
TubeGeometryObjectTubeGeometry class constructor. Tube extruded along a Catmull-Rom spline through waypoints.
ExtrudeGeometryObjectExtrudeGeometry class constructor. Extrudes a closed 2D polygon along +Y. No bevel, no holes.
BufferGeometryObjectBufferGeometry class constructor. Custom mesh from raw arrays: chain setPositions()/setIndices() (optionally setUVs()/setNormals()) and call build() to finalize. Normals are auto-computed if omitted.
HeightfieldGeometryObjectHeightfieldGeometry 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).
ExternalGeometryObjectExternalGeometry class constructor. Wraps a native Lens Studio mesh asset (e.g. obtained via core3d.loadModel()).
AABBObjectAABB class constructor. Axis-aligned bounding box defined by two vec3 corners.
PBRMaterialObjectPBRMaterial class constructor. Physically based material with baseColor / metallic / roughness / emissive / textures.
UnlitMaterialObjectUnlitMaterial class constructor. Ignores scene lighting; renders a flat color or texture.
ToonMaterialObjectToonMaterial class constructor. Stylized toon-shaded material.
ExternalMaterialObjectExternalMaterial class constructor. Wraps a native Lens Studio Material asset (e.g. attached to a mesh imported via core3d.loadModel()). Call .toPBR() to convert.
MeshObjectMesh class constructor. The renderable 3D object: geometry + material. Extends Object3D. Set physical=true to enable physics, dynamic=true for force-driven motion.
RayObjectRay class constructor. Mutable origin + direction holder used by Raycaster.
RaycasterObjectRaycaster class constructor. Performs ray and sphere-sweep scene intersection queries against physical meshes.
loadModelObjectImport 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.
createPointJointObjectCreate 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.
createHingeJointObjectCreate 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.
createFixedJointObjectWeld two physical meshes together at their current relative pose. Auto-disables collisions between the two bodies.
removeJointvoidRemove a joint previously created by createPointJoint / createHingeJoint / createFixedJoint. No-op on null.
ignoreCollisionvoidDisable collisions between two physical meshes. Symmetric. Safe to call repeatedly.
restoreCollisionvoidRe-enable collisions previously disabled with ignoreCollision. Symmetric.
ignoreCollisionsAmongvoidDisable 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.
OcclusionMaterialObjectOcclusionMaterial 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.
WorldDebugMaterialObjectWorldDebugMaterial 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.
ShadowMaterialObjectShadowMaterial 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.
WorldObjectWorld 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.
InstancedMeshObjectInstancedMesh 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.
InstancedPBRMaterialObjectInstancedPBRMaterial 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.
InstancedUnlitMaterialObjectInstancedUnlitMaterial 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.
RibbonGeometryObjectRibbonGeometry 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.
TaperedTubeGeometryObjectTaperedTubeGeometry 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.
TextGeometryObjectTextGeometry 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.
More in Utilities & Storage
- Canvas APIDraws the 2D graphics a game needs, such as a game board, a health bar or puzzle pieces. Ask for a 2D game or a sliding puzzle.
- Model StoreHolds up to ten 3D models under names you pick, so other parts of the Lens can find each one. It shows nothing on the screen by itself.
- Persistent StorageSaves small amounts of information on your device, so the Lens remembers it next time you open it. Use it for your settings, your progress or your own best score.
- SortingAdds a game where you drag your friends into roles, for example BFF or Nemesis. Name two to six roles, or sort up to six pictures of your own instead.
- Sprite StoreHolds up to ten pictures that a 2D game uses, such as characters, cars or enemies. It also holds a photo or video you add yourself.
- Texture StoreHolds up to ten pictures under names you pick, so other parts of the Lens can find each one. It shows nothing on the screen by itself.
