Skip to main content
File: Assets/_MolcaSDK/_VR/Scripts/Scenario/Steps/LookAtStep.cs
Base: Step

Role

Tracks head/camera forward vs target direction; accumulates dwell time inside a configurable cone; optional reset when look leaves the cone. May bind to ProgressFeedbackUI.

Code

Update (when active) tests gaze vs target with IsLookingAtTarget; accumulates requiredLookTime inside lookAngleThresholdDegrees. When reached, calls Complete(). resetProgressWhenLookAway clears dwell when the cone is lost. Optional ProgressFeedbackUI from feedbackUIRef; target/head use SceneObjectReferenceReferenceableComponent transforms (head defaults to Camera.main if unset).

Troubleshooting

  • No target / no head — Logs error if lookAtTargetRef invalid or Camera.main missing when head reference unset.
  • Dwell never fills — Widen cone angle, move target closer, or check wrong ReferenceableComponent on the target object.
  • Progress resets unexpectedly — Disable resetProgressWhenLookAway for “sticky” progress.

Unity Editor

LookAtStep with target ref and threshold fields visible.

LookAtStep in Unity Inspector