Text Object Facade (TextObject)
The TextObject is the SDK bridge for rendering and configuring dynamic text blocks in the 3D scene (type: 'TEXT'). It extends the base ISceneObject interface and inherits standard spatial transform and material features.
Developers declare relationships to TextObject instances using the @SceneObjectProperty() decorator. Once hydrated, they can query and update direct text properties, call action inputs, and listen to event outputs.
Example: Custom Path Render Injection#
Example showing how to inject dynamic SVG paths into a TextObject.
// Render custom SVG characters dynamically
const customPath = "<svg>...</svg>";
this.statusText.svgString(customPath);Example: Click Event & Memory Teardown#
Example showing how to attach an event listener to a TextObject and clean up correctly to prevent memory leaks.
import { Setup, Dispose, Operator, SceneObjectProperty, TextObject } from "@aircada/spec";
import { SceneObjects } from "../registry/scene.registry";
@Operator({
name: "Interactive Text Toggle",
type: "INTERACTIVE_TEXT_TOGGLE"
})
export class TextToggle {
// Direct 3D mesh reference: matches an actual object in the 3D scene configured and referenced in the auto-generated scene.registry file.
@SceneObjectProperty()
targetText: TextObject = SceneObjects.WARNING_LABEL;
private unsubscribeToClick?: () => void;
@Setup()
setup() {
// Attach click listener and save unsubscribe callback
this.unsubscribeToClick = this.targetText.onClick.addListener(() => {
console.log("Label clicked! Toggling Bevel...");
this.targetText.isBevelEnabled = !this.targetText.isBevelEnabled;
});
}
@Dispose()
dispose() {
// Prevent memory leaks by cleaning up the listener
this.unsubscribeToClick?.();
}
}Example: Declaring and Referencing a TextObject#
Example showing how to declare and reference a TextObject in an Operator class.
import { Setup, Operator, SceneObjectProperty, TextObject } from "@aircada/spec";
import { SceneObjects } from "../registry/scene.registry";
@Operator({
name: "Text Billboard Controller",
type: "TEXT_BILLBOARD_CONTROLLER"
})
export class TextBillboardController {
// Direct 3D mesh reference: matches an actual object in the 3D scene configured and referenced in the auto-generated scene.registry file.
@SceneObjectProperty()
statusText: TextObject = SceneObjects.STATUS_LABEL_1;
@Setup()
setup() {
// Directly change text label at startup
this.statusText.textValue = "System Initialized";
}
}Example: Modifying Typography and Bevels#
Example showing how to enable extruded 3D text and configure smooth bevels dynamically.
// Enable extruded 3D text and configure smooth bevels
this.statusText.textValue = "Warning: High Temp!";
this.statusText.useExtrusion = true;
this.statusText.isBevelEnabled = true;
this.statusText.textBevelThickness = 0.02;
this.statusText.textBevelSize = 0.01;TextObject Action Inputs (@Input)#
Inputs represent imperative commands that can be triggered on TextObject facades:
Available Inputs:
- show(): Renders character meshes visible in the scene and enables interactive raycast listeners.
- hide(): Suspends character mesh rendering and disables collision detection.
- svgString(payload: string): Dynamically updates the text rendering using custom raw SVG path strings.
- dataInput(payload: DataBlock[]): Streams dynamic data blocks to drive visual styling or animation states.
- show() / hide(): Dynamic visibility switches.
- svgString(payload): Custom vector path rendering intake.
- dataInput(payload): Dynamic pipeline data input channel.
TextObject Event Outputs (@Output)#
Outputs allow Operators to subscribe to reactive runtime events dispatched by the TextObject:
Available Outputs:
- onClick: AirEvent<void>: Fired once upon completing a click or tap interaction on the text bounds.
- whileHeld: AirEvent<void>: Dispatched continuously every tick while the user maintains an active click, grip, or select on the text.
- onRelease: AirEvent<void>: Dispatched when a mouse click or select interaction is ended.
- dataOutput: AirEvent<DataBlock[]>: Emits processed data blocks downstream to linked scene nodes.
- onClick: Standard user interaction listener.
- whileHeld: Real-time engagement stream, excellent for custom dragging.
- onRelease: Interaction completed signal.
- dataOutput: Custom pipeline event emitter for transferring serializable states.
TextObject Direct Properties#
A TextObject exposes geometric and typographical parameters to modify rendered text appearance in real time.
Typographic and Extrusion Properties:
- textValue: string: The actual string text to display in the scene.
- textFontSize: number: Absolute font scale size (FLOAT, Range: 0 to 200).
- letterSpacing: number: Horizontal padding between characters (FLOAT, Range: -100 to 100).
- useExtrusion: boolean: Toggles between flat 2D billboard text and solid extruded 3D text geometry.
- textSmoothing: number: Density of mesh subdivision smoothing (FLOAT, Range: 1 to 5).
- normalSmoothing: number: Normal interpolation threshold (FLOAT, Range: 0 to 1).
- isBevelEnabled: boolean: Enables rounded/slanted bevel edges along character boundaries.
- textBevelThickness: number: Depth of the bevel extrusion (FLOAT, Range: 0 to 0.1).
- textBevelSize: number: Width/inset distance of the bevel (FLOAT, Range: 0 to 0.1).
- fontSelection: any: Complex typography variant mapping containing the custom media asset ID.
- textValue: Main display text, safe for real-time updates.
- useExtrusion: Dynamic toggle for 2D flat vs 3D solid rendering.
- isBevelEnabled: Adds premium bevel edges to 3D characters.
Material, Transform, and Effects Facades#
Like other physical scene facades, TextObject structures sub-properties to partition rendering and location parameters:
- .material: Exposes physical render characteristics such as surface color, roughness, metalness, and opacity. For complete details, see the 3D Materials & Facades reference guide.
- .transform: Handles physical 3D positioning, scaling, and rotation. For complete details, see the 3D Transforms & Coordinates reference guide.
- .effects: Accesses custom runtime shader behaviors like glow panels, custom hover overlays, and highlight systems. For complete details, see the The Effects Facade API reference guide.






