Head Tracking Hook for XWA
Moderator: JeremyaFr
Head Tracking Hook for XWA
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
A few days ago, Justagai was kind enough to send me the source code for his cockpit look hook. I extended it to add support for FreePIE and SteamVR (so, this is 90% Justagai's work).
The new hook can be downloaded from this location:
https://www.dropbox.com/s/svjq1lerwkg57 ... 1.zip?dl=0
This is *not* a mouse look hook. Mouse look doesn't have to be enabled for this hook to work -- in fact, if you enable mouse look and then move the mouse it probably won't work.
In other words, the absolute position of the head tracker is directly applied to the in-game's camera. All you need to do is display the cockpit. I've tested this hook for a while and I usually only have to calibrate the position once at the beginning. I haven't noticed any significant drift yet (or at all, actually).
This hook currently supports FreePIE and SteamVR. SteamVR requires a VR headset; but FreePIE can be used with a number of solutions that don't require VR at all. I'll add support for other trackers (like OpenTrack) later.
NOTE: This hook conflicts with "Hook_Windowed.dll". So just move that DLL out of the installation directory or rename the extension for ".dl_".
Enjoy!
The new hook can be downloaded from this location:
https://www.dropbox.com/s/svjq1lerwkg57 ... 1.zip?dl=0
This is *not* a mouse look hook. Mouse look doesn't have to be enabled for this hook to work -- in fact, if you enable mouse look and then move the mouse it probably won't work.
In other words, the absolute position of the head tracker is directly applied to the in-game's camera. All you need to do is display the cockpit. I've tested this hook for a while and I usually only have to calibrate the position once at the beginning. I haven't noticed any significant drift yet (or at all, actually).
This hook currently supports FreePIE and SteamVR. SteamVR requires a VR headset; but FreePIE can be used with a number of solutions that don't require VR at all. I'll add support for other trackers (like OpenTrack) later.
NOTE: This hook conflicts with "Hook_Windowed.dll". So just move that DLL out of the installation directory or rename the extension for ".dl_".
Enjoy!
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
Amazing work!
I am also hopeful for future TrackIR compatibility!
I am also hopeful for future TrackIR compatibility!
X-Wing pilot since 1993 and still kickin'
- ual002
- Posts: 983
- Joined: Wed Sep 24, 2008 2:23 am
Same, I have track IR, but I think free track is useable with the track IR hardware. Guess I need to start putting IR reflector strips on my TIE pilot helmet.
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Alright, I hear you guys: TrackIR support is coming next. However, since I don't have TrackIR, I'm going to need your help here. From what I understand, TrackIR is not open source and the devs behind it are very careful about who they share it with. On the other hand, I believe OpenTrack supports TrackIR.
So, here's my question for you guys: if I add support for OpenTrack, will that be enough to support TrackIR as well?
So, here's my question for you guys: if I add support for OpenTrack, will that be enough to support TrackIR as well?
- ual002
- Posts: 983
- Joined: Wed Sep 24, 2008 2:23 am
If you get that far, I think we can start finding out for you. I swear i used freetrack for something with my track IR hardware before.
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
FreeTrack 2.2.0.279 - Maintenance Release ( on 11.20.2008 at 11:20 )
This is a maintenance release.
Natural Point™ requested us to remove Track-IR™ cameras support from FreeTrack.
This is a maintenance release.
Natural Point™ requested us to remove Track-IR™ cameras support from FreeTrack.
X-Wing pilot since 1993 and still kickin'
- ual002
- Posts: 983
- Joined: Wed Sep 24, 2008 2:23 am
Good grief. It must have been after 2008 when I did it so that means I had some hack or workaround I think.
That or at the time they announced that they asked to remove support, and then never addressed if they did actually remove support, and then when you actually tried it still worked. It was some janky word-jitsu-fu designed to be a big middle finger to NaturalPoint.
Either way, I remember that was the reason I stopped recommending Track IR.
I think the project i tried it on was a 64bit linux build of Kerbal space program and that would have had to have been post 2011.
EDIT: I think it may have been an older version of freetrack that still had ingrained TrackIR camera support. According to the forums it was removed in later versions. If we can still download older versions of freetrack it might work. So DL FreeTrack V2.2 instead of the 2.2.0.279 Maintenance release that removed support. When bluemax gets Freetrack support sorted, I'm going to test with 2.2
That or at the time they announced that they asked to remove support, and then never addressed if they did actually remove support, and then when you actually tried it still worked. It was some janky word-jitsu-fu designed to be a big middle finger to NaturalPoint.
Either way, I remember that was the reason I stopped recommending Track IR.
I think the project i tried it on was a 64bit linux build of Kerbal space program and that would have had to have been post 2011.
EDIT: I think it may have been an older version of freetrack that still had ingrained TrackIR camera support. According to the forums it was removed in later versions. If we can still download older versions of freetrack it might work. So DL FreeTrack V2.2 instead of the 2.2.0.279 Maintenance release that removed support. When bluemax gets Freetrack support sorted, I'm going to test with 2.2
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
Looking at FreePIE on the Script Examples page it looks like there is already a way to import TrackIR data, but I know nothing of Python scripting.
Code: Select all
def update():
yaw = trackIR.yaw
pitch = trackIR.pitch
X-Wing pilot since 1993 and still kickin'
X-Wing pilot since 1993 and still kickin'
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
This is interesting. I'm coding "blind" here; but I think the script needs to look like this:ffaaway wrote: ↑Wed May 29, 2019 4:11 pmLooking at FreePIE on the Script Examples page it looks like there is already a way to import TrackIR data, but I know nothing of Python scripting.
Code: Select all
def update():
freePieIO[0].yaw = trackIR.yaw
freePieIO[0].pitch = trackIR.pitch
diagnostics.watch(freePieIO[0].yaw)
diagnostics.watch(freePieIO[0].pitch)
if starting:
trackIR.update += update
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
You can also try the following script just to check if FreePIE supports TrackIR:
Again, you guys should see some values in the Watch tab after running this script. Also, the XWA cockpit look hook expects values in degrees in the following ranges:
yaw:
right: 90
back: 180
left: 270
front: 0/360
pitch:
up: 90
front: 0/360
down: -90
back: 0/360
Code: Select all
diagnostics.watch(trackIR.yaw)
diagnostics.watch(trackIR.pitch)
yaw:
right: 90
back: 180
left: 270
front: 0/360
pitch:
up: 90
front: 0/360
down: -90
back: 0/360
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Alright guys. I wrote a small console application that attempts to read from TrackIR. You can download it here:
https://www.dropbox.com/s/u1yp20rijk0uh ... r.exe?dl=0
It should be placed on the same path as TrackIR -- or more specifically, it should be placed right next to NPClient.dll.
I don't have TrackIR hardware, so I tested it with a simulator of sorts. Can any of you test this for me?
https://www.dropbox.com/s/u1yp20rijk0uh ... r.exe?dl=0
It should be placed on the same path as TrackIR -- or more specifically, it should be placed right next to NPClient.dll.
I don't have TrackIR hardware, so I tested it with a simulator of sorts. Can any of you test this for me?
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
Trying to test the TrackIR-tester but getting vcruntime140d.dll and ucrtbased.dll not found errors.
Tried installing Microsoft Visual C++ 2015 Redistributable Update 3 RC but it says I already have a newer version installed, and now I have to go to work.
lol
Will try and sort this out later.
Tried installing Microsoft Visual C++ 2015 Redistributable Update 3 RC but it says I already have a newer version installed, and now I have to go to work.
lol
Will try and sort this out later.
X-Wing pilot since 1993 and still kickin'
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Ugh, sorry about that, Try this version instead (I removed the dependencies to the VC runtime):
https://www.dropbox.com/s/04783ql2rjkzv ... r.exe?dl=0
In my case, I have to place this file under "C:\Program Files (x86)\NaturalPoint\TrackIR5". Thanks for your help and patience!
https://www.dropbox.com/s/04783ql2rjkzv ... r.exe?dl=0
In my case, I have to place this file under "C:\Program Files (x86)\NaturalPoint\TrackIR5". Thanks for your help and patience!
- ual002
- Posts: 983
- Joined: Wed Sep 24, 2008 2:23 am
1. Ok, got my Track IR camera out and track clip pro on my headset.
2. Installed Track IR Software 5.4.2
3. Moved Hook_Windowed.dll to its own UNUSED HOOKS FOLDER
4. Installed TrackIR-Tester.exe @ my C:\Program Files (x86)\NaturalPoint\TrackIR5
5. Installed your file below in
Hook_XWACockpitLook.dll
openvr_api.dll
cockpitlook.cfg
6. Ran Track IR Software and your TrackIR-Tester.exe
-I see a windo pop up continuously outputting
[DBG] [Cockpitlook] yaw: 0.000, pitch 0.000
Doesn't seem to change with motion of track IR camera.
7. Ran game, loaded a mission. Loads to hangar, after hitting space to leave hangar and the animation leaving the hangar finishes, the game crashes to desktop.
2. Installed Track IR Software 5.4.2
3. Moved Hook_Windowed.dll to its own UNUSED HOOKS FOLDER
4. Installed TrackIR-Tester.exe @ my C:\Program Files (x86)\NaturalPoint\TrackIR5
5. Installed your file below in
Hook_XWACockpitLook.dll
openvr_api.dll
cockpitlook.cfg
6. Ran Track IR Software and your TrackIR-Tester.exe
-I see a windo pop up continuously outputting
[DBG] [Cockpitlook] yaw: 0.000, pitch 0.000
Doesn't seem to change with motion of track IR camera.
7. Ran game, loaded a mission. Loads to hangar, after hitting space to leave hangar and the animation leaving the hangar finishes, the game crashes to desktop.
- ual002
- Posts: 983
- Joined: Wed Sep 24, 2008 2:23 am
1. Ok, got my Track IR camera out and track clip pro on my headset.
2. Installed Track IR Software 5.4.2
3. Moved Hook_Windowed.dll to its own UNUSED HOOKS FOLDER
4. Installed TrackIR-Tester.exe @ my C:\Program Files (x86)\NaturalPoint\TrackIR5
5. Installed your file below in
Hook_XWACockpitLook.dll
openvr_api.dll
cockpitlook.cfg
6. Ran Track IR Software and your TrackIR-Tester.exe
-I see a windo pop up continuously outputting
[DBG] [Cockpitlook] yaw: 0.000, pitch 0.000
Doesn't seem to change with motion of track IR camera.
7. Ran game, loaded a mission. Loads to hangar, after hitting space to leave hangar and the animation leaving the hangar finishes, the game crashes to desktop.
I feel like I'm missing an obvious step here. I also wonder if it is conflicting with one of Justagai's hooks. Point is I'm not sure I have a control experiment setup here.
2. Installed Track IR Software 5.4.2
3. Moved Hook_Windowed.dll to its own UNUSED HOOKS FOLDER
4. Installed TrackIR-Tester.exe @ my C:\Program Files (x86)\NaturalPoint\TrackIR5
5. Installed your file below in
Hook_XWACockpitLook.dll
openvr_api.dll
cockpitlook.cfg
6. Ran Track IR Software and your TrackIR-Tester.exe
-I see a windo pop up continuously outputting
[DBG] [Cockpitlook] yaw: 0.000, pitch 0.000
Doesn't seem to change with motion of track IR camera.
7. Ran game, loaded a mission. Loads to hangar, after hitting space to leave hangar and the animation leaving the hangar finishes, the game crashes to desktop.
I feel like I'm missing an obvious step here. I also wonder if it is conflicting with one of Justagai's hooks. Point is I'm not sure I have a control experiment setup here.
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
I̶'̶m̶ ̶n̶o̶t̶ ̶t̶h̶e̶ ̶e̶x̶p̶e̶r̶t̶ ̶h̶e̶r̶e̶ ̶b̶u̶t̶ ̶I̶ ̶d̶o̶n̶'̶t̶ ̶t̶h̶i̶n̶k̶ ̶y̶o̶u̶ ̶n̶e̶e̶d̶ ̶o̶p̶e̶n̶v̶r̶_̶a̶p̶i̶.̶d̶l̶l̶ ̶w̶i̶t̶h̶ ̶t̶r̶a̶c̶k̶i̶r̶.̶
This .dll is needed! See below.
This .dll is needed! See below.
Last edited by ffaaway on Fri May 31, 2019 4:49 am, edited 1 time in total.
X-Wing pilot since 1993 and still kickin'
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
Here are my results.
Full size image:
https://drive.google.com/file/d/1LsHJ3u ... sp=sharing
Tester doesn't seem to be polling the TrackIR software. I do have NPClient64.dll, maybe it needs to look for the 64 bit version??
X-Wing pilot since 1993 and still kickin'
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
This script is WORKING! FreePIE is getting data from TrackIR and the values match with your given ranges.blue_max wrote: ↑Thu May 30, 2019 5:11 amYou can also try the following script just to check if FreePIE supports TrackIR:
Again, you guys should see some values in the Watch tab after running this script. Also, the XWA cockpit look hook expects values in degrees in the following ranges:Code: Select all
diagnostics.watch(trackIR.yaw) diagnostics.watch(trackIR.pitch)
yaw:
right: 90
back: 180
left: 270
front: 0/360
pitch:
up: 90
front: 0/360
down: -90
back: 0/360
X-Wing pilot since 1993 and still kickin'
- Driftwood
- Posts: 2174
- Joined: Wed Oct 22, 2003 11:01 pm
- Contact:
Well, if this winds up functional then this may make me happier with the game in a big way lol.
- ffaaway
- Posts: 92
- Joined: Mon May 05, 2003 11:01 pm
Ok, I loaded the script above in FreePIE and it does appear to be getting tracking data from trackIR.blue_max wrote: ↑Wed May 29, 2019 5:19 pmThis is interesting. I'm coding "blind" here; but I think the script needs to look like this:ffaaway wrote: ↑Wed May 29, 2019 4:11 pmLooking at FreePIE on the Script Examples page it looks like there is already a way to import TrackIR data, but I know nothing of Python scripting.
Save this to a file, say "trackir.py", run FreePIE and load the script. Then go to Script -> Run Script (or press F5) and check the lower tab named "Watch". Let me know if that works...Code: Select all
def update(): freePieIO[0].yaw = trackIR.yaw freePieIO[0].pitch = trackIR.pitch diagnostics.watch(freePieIO[0].yaw) diagnostics.watch(freePieIO[0].pitch) if starting: trackIR.update += update
ran the game
mouselook works normally in the hangar, but is disabled once in flight - as per the readme
but FreePIE doesn't seem to be communicating with the game
I made no changes to the cockpitlook.cfg
Code: Select all
tracker_type = FreePIE
yaw_multiplier = 1
pitch_multiplier = 1
What else could I be missing? This SEEMS SO CLOSE!!!!
Oh, and Hook_Windowed.dll is moved out of XWA folder.
Edit 2 -
FIXED AND WORKING!! Thanks to ual002 for correcting me needing the openvr_api.dll
Last edited by ffaaway on Fri May 31, 2019 4:47 am, edited 2 times in total.
X-Wing pilot since 1993 and still kickin'