VREngine class

Main VR engine. Manages the game loop, scene, camera, and rendering.

final engine = VREngine();
engine.scene.add(myMesh);
engine.start();

// In your widget:
CustomPaint(painter: engine.stereoPainter)
Inheritance

Constructors

VREngine({Scene? scene, CameraRig? cameraRig})

Properties

cameraRig → CameraRig
final
culledCount → int
no setter
desktopInput ↔ DesktopInputDriver?
getter/setter pair
externalDwellSuppressed ↔ bool
A spatial renderer can reserve dwell for its own world-space controls.
getter/setter pair
fps → double
no setter
frameCount → int
no setter
frameTimeMs → double
no setter
gazePointer ↔ GazePointer?
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
headTracker ↔ HeadTracker?
getter/setter pair
inertialTapDetector ↔ InertialTapDetector?
getter/setter pair
interactionRay → Ray
Borrowed world ray shared by gameplay and explicit selection.
no setter
isDwellEnabled → bool
no setter
isRunning → bool
no setter
monoPainter → VREnginePainter
Creates a CustomPainter that renders monoscopically.
no setter
onUpdate ↔ void Function(double dt)?
Callback fired each frame after update.
getter/setter pair
renderedCount → int
no setter
renderPass ↔ RenderPass
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scene → Scene
final
spatialInput → VrSpatialInputState
final
stereoPainter → VREnginePainter
Creates a CustomPainter that renders stereoscopically.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
bindInput(VrInputArbiter? arbiter) → void
Shares arbitration and pointer state with the host; does not own it.
disableDesktopInput() → void
Disables desktop input.
disableGazePointer() → void
Disables the gaze pointer.
disableHeadTracking() → void
Disables head tracking.
disableInertialTap() → void
Disables inertial tap detector.
dispose() → void
Discards any resources used by the object.
override
enableDesktopInput({double lookSensitivity = 0.0035, double moveSpeed = 3.0, double sprintMultiplier = 2.5}) → DesktopInputDriver
Enables desktop input (mouse-look, WASD locomotion, mouse-picking). Returns the driver so the widget layer can forward pointer/key events (see DesktopInputRegion).
enableGazePointer({double dwellDuration = 2.0}) → void
Enables gaze-based interaction pointer (look-to-select).
enableHeadTracking({double sensitivity = 1.0}) → void
Enables gyroscope head tracking. sensitivity 1.0 (default) = true 1:1 tracking, ideal for VR.
enableInertialTap({VoidCallback? onSingleTap, VoidCallback? onDoubleTap}) → void
Enables zero-latency temple/visor physical tap detection.
handleTap() → void
Exposes screen tap event (e.g. Cardboard viewer button click) and propagates it to the gazed interactive target.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyGameStateChanged() → void
Publishes an explicit game action without advancing simulation time.
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setExternalInteractionRay(Ray? ray) → void
Copies a renderer's current ray. Passing null restores the core ray. This avoids retaining a borrowed/pooled input object across frames.
start() → void
Starts the game loop, synchronized to the display's vsync when a SchedulerBinding is available (less jitter → less VR motion sickness than a fixed 16ms timer). Falls back to a ~60fps timer in headless environments (tests, isolates without a binding).
step(double dt, {bool integrateInput = true}) → void
Advances simulation without drawing or scheduling another frame.
stop() → void
Stops the game loop.
toString() → String
A string representation of this object.
inherited
updateInput(double dt) → void
Integrates held input once per rendered frame. Public for headless hosts.
useExternalFrameDriver() → void
Transfers frame and sensor ownership to an external spatial renderer. Game rules and the source scene remain available through step.

Operators

operator ==(Object other) → bool
The equality operator.
inherited