Class HeadLookController

java.lang.Object
eu.svjatoslav.aukio.e3d.gui.headtrack.HeadLookController
All Implemented Interfaces:
FrameListener

public final class HeadLookController extends Object implements FrameListener
Applies head orientation from XR glasses to the camera, every frame: turn your head left and the view pans left, look up and the view tilts up. The virtual world stays fixed in space while the display moves with your head.

Complementary mouse look: mouse drag and head tracking compose instead of fighting. Every frame the controller compares the camera rotation against what it wrote last frame; a mismatch means the mouse moved the view, and the difference is folded into the base yaw/pitch so the view stays exactly where the mouse put it — subsequent head motion then composes on top. Head movement during a drag is not lost: it re-applies as a relative delta once the drag ends.

Press Scroll Lock to recenter: the current head pose becomes "straight ahead" and the camera returns to its base pose. Needed occasionally because gyro-only yaw drifts slowly.

Arrow-key movement and wheel vertical movement are unaffected (they translate, not rotate).

Head roll is measured but deliberately not applied — a constant world horizon reads better than a world that tilts with your neck.

  • Constructor Details

  • Method Details

    • onFrame

      public boolean onFrame(ViewPanel viewPanel, int millisecondsSinceLastFrame)
      Description copied from interface: FrameListener
      Called before each frame render, allowing the listener to update state and indicate whether a repaint is needed.

      Each registered listener is called exactly once per frame tick. The frame is only rendered if at least one listener returns true (or if the view was explicitly marked for repaint).

      Specified by:
      onFrame in interface FrameListener
      Parameters:
      viewPanel - the view panel being rendered
      millisecondsSinceLastFrame - time elapsed since the previous frame, for frame-rate-independent updates
      Returns:
      true if the view should be re-rendered this frame, false if this listener has no visual changes