78 3D: Animating the 3D camera
procedure
(camera3d-move-to view-id position) → any/c
view-id : symbol? position : vec3?
procedure
(camera3d-look-at-to view-id target [#:up up]) → any/c
view-id : symbol? target : vec3? up : vec3? = y-axis3
procedure
(camera3d-orbit-by view-id [ #:center center #:azimuth azimuth #:elevation elevation]) → any/c view-id : symbol? center : vec3? = origin3 azimuth : finite-real? = 0 elevation : finite-real? = 0
procedure
(camera3d-roll-to view-id angle) → any/c
view-id : symbol? angle : finite-real?
procedure
(camera3d-field-of-view-to view-id field-of-view) → any/c view-id : symbol? field-of-view : finite-real?
procedure
(camera3d-orthographic-height-to view-id height) → any/c view-id : symbol? height : positive-real?
procedure
(camera3d-dolly-by view-id distance) → any/c
view-id : symbol? distance : finite-real?
procedure
(camera3d-fit view-id [#:padding padding]) → any/c
view-id : symbol? padding : positive-real? = 11/10
procedure
(camera3d-follow view-id path) → any/c
view-id : symbol? path : spatial-path?
All these forms work as leaves of timed, succession, animation-group, and lagged-start. A 3D camera remains separate from the ordinary two-dimensional render camera, so a formula or caption stays fixed while the view’s spatial camera moves.
In interactive preview, an inspection camera is an overlay on the authored camera: drag in a spatial viewport to orbit, shift-drag to pan its target, use the mouse wheel to dolly (or orthographic zoom), and press R to return to the authored view. The override is part of the immutable preview render request—including a subprocess worker request—and is never written into source or the Scene. The Animate menu can reset it or copy an expression/animation scratch form for authoring.
For runnable examples, see "examples/3d/wireframe-cube.rkt", "examples/3d/opaque-cube.rkt", and "examples/3d/depth-test.rkt"; "examples/3d/camera-orbit.rkt" is the canonical motion probe.
Current limitation: opaque mode is a software rasterizer for filled triangles. It has flat, unlit, and smooth shading, depth-aware transparency, spatial relations, projected labels, specular response, and directional/spot shadows. It does not provide general mesh texture mapping or order-independent transparency. Picking is covered by the inspection chapters. An ordinary two-dimensional traversal of a spatial child is rejected: use rooted 3D animation paths or view3d-spatial-*.