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
GlyphFirstPersonControlsDrag looks around; WASD / arrows moveWalk-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-drag looks around; WASD / arrow keys move the camera. Good for walk-through environments and large scenes where the mesh fills the whole grid.

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

PropTypeDefaultDescription
dragbooleantrueEnable pointer-drag look
keyboardbooleantrueEnable WASD / arrow key movement
moveSpeednumber0.05World units per keypress
lookSpeednumber0.15Degrees per pixel of drag
invertboolean | numberfalseInvert look direction
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 drag keyboard moveSpeed={0.1} />
<GlyphMesh polygons={floor} />
</GlyphScene>
</GlyphPerspectiveCamera>
);
}