Skip to content

Interface: UseBodyOptions

Optional hooks accepted by useBody — light source, palette override, hover-cursor presets, render-quality knobs.

Every field is optional: leaving the object empty (or omitted) yields a lib-default body. Fields are documented inline so IntelliSense surfaces the rationale at the call site.

Properties

sunLight?

ts
optional sunLight?: 
  | PointLight
  | DirectionalLight
  | null;

Light source illuminating the body. On every tick(), the lib reads sunLight.getWorldPosition(), computes a normalized planet→sun direction and pushes it into the body shader (and atmo shell). Pass a single PointLight shared across all bodies of the same star system — the same instance that lives in the scene as the visible light source. Bodies without rings or atmosphere simply ignore it if absent (the shader keeps its last known direction, defaulting to the +X axis at construction time).


palette?

ts
optional palette?: TerrainLevel[];

hoverChannel?

ts
optional hoverChannel?: HoverChannel;

graphicsUniforms?

ts
optional graphicsUniforms?: GraphicsUniforms;

quality?

ts
optional quality?: RenderQuality;

variation?

ts
optional variation?: BodyVariation;

hoverCursor?

ts
optional hoverCursor?: HoverCursorConfig;

Hover cursor parameters — single style.


hoverCursors?

ts
optional hoverCursors?: HoverCursorPresets;

Hover cursor presets — multiple named styles, swapped at runtime.


defaultCursor?

ts
optional defaultCursor?: string;

Initial preset name when hoverCursors is supplied.


initialView?

ts
optional initialView?: InteractiveView;

View applied right after construction. Omitted → the body keeps its assembled default (smooth display sphere visible, atmo halo shell not yet mounted). Pass 'shader' for a ready-to-display overview without having to call view.set() by hand. Ignored by stars (no view switch).


raycastable?

ts
optional raycastable?: boolean;

When false, every renderable mesh of the body is made transparent to scene raycasting (display-only), so a caller can place its own hitbox and pick it without the atmo shell or smooth sphere intercepting the ray. Interactive hover queries (hex picking) are unaffected — they run through a dedicated proxy. Defaults to true.

Distribué sous la licence indiquée dans le dépôt.