If any mod is reading this, feel free to delete this if it has already been used. Otherwise, I would like help improving a code for Table top simulator.
PSA for anyone else who is brand new to FreePIE, filter.delta() is a thing.
I am using Freetrack with a wii remote for the IR led tracking on a vr head set, trying to get 5-6 DOF to smoothly work, and have a basic script written up.
Code: Select all
def update():
yaw = filters.mapRange(trackIR.yaw, -90, 90, -vJoy[0].axisMax, vJoy[0].axisMax)
pitch = filters.mapRange(trackIR.pitch, -90, 90, -vJoy[0].axisMax, vJoy[0].axisMax)
roll = filters.mapRange(trackIR.roll, -90, 90, -vJoy[0].axisMax, vJoy[0].axisMax)
xVal = filters.mapRange(trackIR.x, -90, 90, -vJoy[0].axisMax, vJoy[0].axisMax)
yVal = filters.mapRange(trackIR.y, -90, 90, -vJoy[0].axisMax, vJoy[0].axisMax)
zVal = filters.mapRange(trackIR.z, -90, 90, -vJoy[0].axisMax, vJoy[0].axisMax)
vJoy[0].rx = filters.delta(yaw*100)
vJoy[0].ry = filters.delta(pitch*100)
vJoy[0].rz = filters.delta(roll*100)
vJoy[0].x = filters.delta(xVal*100)
vJoy[0].y = filters.delta(yVal*100)
vJoy[0].z = filters.delta(zVal*100)
diagnostics.watch(vJoy[0].x)
diagnostics.watch(vJoy[0].y)
diagnostics.watch(vJoy[0].z)
diagnostics.watch(vJoy[0].rx)
diagnostics.watch(vJoy[0].ry)
diagnostics.watch(vJoy[0].rz)
if starting:
trackIR.update += update
Edit: I'm considering using the position readout again, but writing a script to move a virtual dot towards the position with the joystick at a certain rate until it is within the position given by FreeTrack, hopefully eliminating the drift issue. I've checked the script, FreeTrack, and the values and apparently the drift has no obvious cause. It will cause some input lag, but it might be worth it. Please let me know if it's been done before. This should make it smoother as well