raea/gizmos

Lines drawn for looking: Bevy's gizmos and debug overlays.

View as Markdown

<Gizmo> draws debug lines with Bevy's gizmo renderer: a path, a box, an axis, a ray. They take and cast no light. <Overlay> and overlays draw the debug overlays raea's checks use, such as safe areas and element boxes, over a frame you're looking at.

TS
import { Gizmo, Overlay, overlays } from "raea/gizmos"

raea/gizmos exports 2 components, 1 function, 3 types. Bevy's counterpart: bevy_gizmos. Source: sdk/raea/src/gizmos.ts.

Components

Gizmo

Debug lines drawn by Bevy's gizmo renderer (a retained bevy_gizmos Gizmo and its GizmoAsset), placed like a part: a path, a bounding box, an axis, a ray. They cast and take no light, and draw over nothing unless depthBias says.

Bevy: bevy_gizmos::retained::Gizmo.

Takes GizmoProps's props.

Used in: 3d/mesh_ray_cast, 3d/rect_light, transforms/align.

Overlay

Its children only in a render asked for the overlay name.

PropTypeWhat it does
name (required)stringthe overlay's name, as the render asks for it
childrenReactNodewhat the overlay draws

Functions

overlays

The overlays this render was asked for ([] in a clean render and in live play).

TS
function overlays(): string[]

Types

GizmoColor

a gizmo point's colour: "#rrggbb", linear [r, g, b, a], or Bevy's LinearRgba / Srgba (bevy3d's colours)

TS
type GizmoColor = string | [number, number, number, number] | { red: number; green: number; blue: number; alpha?: number }

GizmoProps

FieldTypeWhat it is
lines[Vec3, Vec3][]segments, each [from, to]
strip(Vec3 | null)[]one line through these points (null breaks it)
colorGizmoColor | GizmoColor[]one colour for every point, or one per point of lines (two per segment) then strip: "#rrggbb", Bevy's LinearRgba (above 1 for HDR, as bevy_gizmos takes it) or Srgba, or linear [r, g, b, a]
widthnumberline width in pixels (Bevy's default 2)
depthBiasnumber-1 always in front of geometry, 0 depth-tested as it is (Bevy's GizmoLineConfig and depth_bias)
positionVec3where it stands, metres (x, y, z)
rotationVec3its rotation, Euler angles in radians (x, y, z)
scaleVec3 | numberits scale: one number, or x, y and z
namestringthe entity's name, for picking, the inspector and world.*

OverlayProps

The props of Overlay, tabled there.