I have belatedly realised that BeamNG has a native linux binary which is good.  I'm now running this. However, this breaks headtracking as OpenTrack was set up to work with Proton which the native binary doesn't use of course.

There is a BeamNG mod named headtrackOverUDP which allows it to work. Download and copy the zip file to ~/.local/share/BeamNG/BeamNG.drive/current/mods/unpacked (or your local equivalent). You can unzip it here so it is 'unpacked' or you can unpack it in BeamNG. Result =:

Start Opentrack and make sure you have the BeamNG.ini profile loaded. Change the output to use UDP over network.  

Then click the hammer next to it to open options. Change the IP address to 127.0.0.1 and ensure the port is 4242.

Set the Filter to AccelaHamiltion.  If you leave this blank the headtracking will be unusable as the slightest movement is translated into wildly larger movements. 

Click the hammer option and select Output. I had to set my X, Y, and Z outputs to the below to put me in the driver's seat in the car.  

If the headtracking movement is still too exaggerated, you can play with the filter settings and increase the deadzone.


Recompilling

I have had to recompile OpenTrack a few times as I run OpenSUSE Tumbleweed and so it gets frequent updates which can break locally compiled programs. This usually shows as a dialog saying that it failed to load a library.

I have set up a build script to make the job easier. I use the 'fish' shell so this works with fish. However it should only need minor changes on setting the variables to make it work with other shells.

#!/usr/bin/fish
set -l SRC $HOME/AA-VSCode/opentrack
set -l ORT $HOME/opentrack/onnxruntime-linux-x64-1.30.0
set -l PREFIX $HOME/opentrack          # run as $PREFIX/bin/opentrack

cd $SRC; or exit 1
test -f $ORT/lib/libonnxruntime.so; or begin; echo "ONNX Runtime not at $ORT"; exit 1; end

# Remove the old in-source build so only one cache exists
rm -rf CMakeCache.txt CMakeFiles build

cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DSDK_WINE=ON \
      -DONNXRuntime_DIR=$ORT -DCMAKE_INSTALL_PREFIX=$PREFIX; or exit 1
cmake --build build -j(nproc); or exit 1
cmake --install build; or exit 1

ls $PREFIX/libexec/opentrack | grep -E 'neural|proto-wine'
ldd $PREFIX/libexec/opentrack/opentrack-tracker-neuralnet.so | grep 'not found'

That's it!