Skip to content

GlyphOrbitControls

glyphcss ships three pointer-based control modes. All must be placed inside a <GlyphScene> (React / Vue) or receive a scene handle (vanilla). The camera component wraps the scene.

ControlInteractionWhen to use
GlyphOrbitControlsLeft-drag orbits; wheel zoomsGeneral-purpose — object inspection
GlyphMapControlsLeft-drag pans; right-drag / Shift+left orbits; wheel zoomsTop-down maps, floor plans
GlyphFirstPersonControlsPointer-lock look; WASD move, jump, crouchWalk-through scenes

GlyphOrbitControls pauses the strip animation on drag, live-rasterizes per pointermove, and re-bakes a fresh strip on release.

PropTypeDefaultDescription
dragbooleantrueEnable click-and-drag rotation
wheelbooleantrueEnable scroll-to-zoom
invertboolean | numberfalseInvert drag direction
animatefalse | { speed?, axis?, pauseOnInteraction? }falseAuto-rotation config
import { GlyphCamera, GlyphScene, GlyphMesh, GlyphOrbitControls } from "@glyphcss/react";
import { icosahedronPolygons } from "@glyphcss/core";
const icosa = icosahedronPolygons({ center: [0, 0, 0], size: 1, color: "#44ffcc" });
export function App() {
return (
<GlyphCamera rotX={25}>
<GlyphScene mode="solid">
<GlyphOrbitControls drag wheel animate={{ axis: "y", speed: 0.5 }} />
<GlyphMesh polygons={icosa} />
</GlyphScene>
</GlyphCamera>
);
}

Left-drag pans the camera target. Right-drag (or Shift + left-drag) orbits. Wheel zooms. Best for top-down maps or floor-plan scenes.

PropTypeDefaultDescription
dragbooleantrueEnable pointer-drag pan
wheelbooleantrueEnable scroll-to-zoom
invertboolean | numberfalseInvert drag direction
animatefalse | { speed?, axis?, pauseOnInteraction? }falseAuto-rotation
import { GlyphCamera, GlyphScene, GlyphMesh, GlyphMapControls } from "@glyphcss/react";
import { cubePolygons } from "@glyphcss/core";
const cube = cubePolygons({ center: [0, 0, 0], size: 1, color: "#4488ff" });
export function MapDemo() {
return (
<GlyphCamera rotX={35}>
<GlyphScene mode="solid" cols={120} rows={36}>
<GlyphMapControls drag wheel />
<GlyphMesh polygons={cube} />
</GlyphScene>
</GlyphCamera>
);
}

Pointer-lock mouselook, WASD / arrow planar move, Space jump, Ctrl crouch — each axis independently toggleable. Good for walk-through environments and large scenes. Click the scene to capture the pointer; Esc releases it.

Requires a perspective camera. GlyphFirstPersonControls throws if attached to a scene with an orthographic camera. Use <GlyphPerspectiveCamera> explicitly (not <GlyphCamera>, which aliases orthographic).

Distances are in world units — size moveSpeed / eyeHeight to your mesh’s scale (the gallery derives them from the model bbox).

PropTypeDefaultDescription
lookEnabledbooleantruePointer-lock mouselook
moveEnabledbooleantrueWASD / arrow planar movement
jumpEnabledbooleantrueSpace-bar jump arc
crouchEnabledbooleantrueCtrl crouch
lookSensitivitynumber0.15Degrees per pixel of mouse
invertYbooleanfalseInvert vertical look
moveSpeednumber5World units per second
jumpVelocitynumber7Initial jump velocity (units/s)
gravitynumber18Gravity (units/s²)
eyeHeightnumber1.7Standing eye height above ground
crouchHeightnumber1Eye height while crouching
groundZnumber0World Z of the ground plane
minPitch / maxPitchnumber5 / 175Pitch clamp (degrees)
import { GlyphPerspectiveCamera, GlyphScene, GlyphMesh, GlyphFirstPersonControls } from "@glyphcss/react";
import { cubePolygons } from "@glyphcss/core";
const floor = cubePolygons({ center: [0, -0.6, 0], size: 4, color: "#334455" });
export function FPVDemo() {
return (
<GlyphPerspectiveCamera>
<GlyphScene mode="solid" cols={140} rows={42}>
<GlyphFirstPersonControls moveSpeed={3} eyeHeight={1.2} />
<GlyphMesh polygons={floor} />
</GlyphScene>
</GlyphPerspectiveCamera>
);
}