HeadTracker class
Head tracking input via device gyroscope with calibration and background Isolate.
Constructors
-
HeadTracker({required RotationTarget target, double sensitivity = 1.0, double pitchGain = 1.0, double predictionMs = 15.0, bool jitterDamping = true, bool? useIsolate, Stream<
GyroscopeEvent> ? gyroscopeStreamOverride, Stream<AccelerometerEvent> ? accelerometerStreamOverride}) -
HeadTracker.forCamera(dynamic camera, {double sensitivity = 1.0, double predictionMs = 15.0, bool? useIsolate, Stream<
GyroscopeEvent> ? gyroscopeStreamOverride, Stream<AccelerometerEvent> ? accelerometerStreamOverride}) -
For backwards compatibility with VRCamera.
factory
Properties
-
accelerometerStreamOverride
→ Stream<
AccelerometerEvent> ? -
final
- canStart → bool
-
Whether a registered platform backend or an injected sensor source can
be started. This does not claim that hardware is present or sending data.
no setter
-
gyroscopeStreamOverride
→ Stream<
GyroscopeEvent> ? -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
Whether gyroscope is available and active.
no setter
- isGyroscopeActive ↔ bool
-
getter/setter pair
- jitterDamping ↔ bool
-
Whether high-frequency sensor jitter damping is active.
getter/setter pair
- pitchGain ↔ double
-
Scale for gravity-referenced pitch; 1.0 preserves the measured tilt.
getter/setter pair
- predictionMs ↔ double
-
Latency prediction compensation in milliseconds.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sensitivity ↔ double
-
Scale for gyro yaw and gyro-only relative pitch. Gravity-referenced pitch
uses pitchGain instead. The default applies no additional delta scaling.
getter/setter pair
- target → RotationTarget
-
final
- useIsolate → bool
-
Whether to use background Isolate for sensor fusion (default: false).
Platforms without isolate support keep using main-thread fusion.
final
Methods
-
applyTouchDelta(
double dx, double dy, {double touchSensitivity = 0.005}) → void - Applies touch/pan rotation when no live gyroscope is delivering samples.
-
calibrate(
) → void - Averages gyro bias over one second while the device is stationary. Slow motion is not automatically treated as bias during normal tracking.
-
dispose(
) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recenter(
) → void - Recenters yaw without inventing pitch when no valid gravity sample exists.
-
start(
) → void - Starts tracking. Keep the device still during the one-second calibration.
-
stop(
) → void - Stops streams, timers, queued worker output and any pending calibration.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited