Skip to content

TrackIR support - #62

Open
raistlen007 wants to merge 5 commits into
elyosh:mainfrom
raistlen007:feature/TrackIR-udp-support
Open

raistlen007 wants to merge 5 commits into
elyosh:mainfrom
raistlen007:feature/TrackIR-udp-support

Conversation

@raistlen007

Copy link
Copy Markdown
Contributor

Adds optional 6DOF head tracking through native TrackIR (Windows NPClient) and OpenTrack UDP (port 4242).

Supports cockpit, turret, external, hyperspace, and hangar views in both classic and remastered renderers.

Implementation

  • Input: Separate TrackIR and OpenTrack providers using a shared pose interface, with configurable axis inversion, source selection, and persistent settings.
  • Camera: Applies head rotation and translation independently of ship controls and turret aiming. Reuses the existing camera transforms and preserves fractional positioning to prevent jitter.
  • HUD: Projects the targeting reticle relative to head orientation while preserving weapon firing direction. Hardpoint indicators use ship-relative positions to avoid distortion from head movement.
  • Hangar: Integrates head tracking with existing hangar camera views without accumulating positional offsets.
    -Options menu: Adds a dedicated Head Tracking screen under Input Options, with source selection, enable/disable controls, axis inversion settings, and persistent configuration.

Validation

  • In-game testing performed in starfighters, all 3 correlian craft, lower and upper turrets, multiple hangar positions, and hyperspace.
  • 120,000 numerical camera-position tests passed, verifying fractional precision.
  • 200,000 mirrored-hardpoint calculations passed, verifying symmetrical indicator placement.

Share one poll path between the TrackIR and OpenTrack sources, with only
the native NPClient part kept to Windows, and write the head-tracked
camera rows through one function. Add the head offset to the packed view
state directly rather than through pointers to its members. Keep the
original reticle code in the non-modern branch, sort the new includes,
center the head tracking menu like the video options, describe both
Windows libraries in CMakeLists.txt, and format the new code.
The pose, the per-frame state and the source switch serve TrackIR and
OpenTrack alike, so they move to head_tracking.c as XwaHeadTracking_* and
XwaHeadPose. trackir.c keeps only the native NPClient source, next to
opentrack_udp.c. The TrackIR name stays where it means the device: the
source option, its config value and the NPClient code.
@raistlen007

Copy link
Copy Markdown
Contributor Author

Merged current main (no conflicts) and cleaned it up:

  • one shared poll path for both sources, and the layer is renamed to head tracking (head_tracking.c, XwaHeadTracking_*); trackir.c only holds the native NPClient code now
  • the original reticle code is back in the non-modern branch
  • no more pointers into the packed viewState
  • clang-formatted, with sorted includes
    Built and tested locally.

…upport

# Conflicts:
#	src/xwa/render/render_scene_core.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant