To do so, I was thinking about "pausing" Roll & Yaw when the device goes above 80° up or down, then start again when it goes lower than 80°.
Here's the script I use:
Code: Select all
def update():
global Yaw
global Pitch
global Roll
global Xaxis
global Yaxis
global Zaxis
Yaw = -trackIR.yaw / 55.0
Pitch = trackIR.pitch / 55.0
Roll = trackIR.roll / 120.0
Xaxis = trackIR.x / 5.0
Yaxis = trackIR.y / 5.0
Zaxis = trackIR.z / 5.0
vireioSMT.yaw = Yaw - centerYaw
vireioSMT.pitch = Pitch - centerPitch
vireioSMT.roll = Roll - centerRoll
vireioSMT.x = Xaxis - centerXaxis
vireioSMT.y = Yaxis - centerYaxis
vireioSMT.z = Zaxis - centerZaxis
if starting:
centerYaw = 0
centerPitch = 0
centerRoll = 0
centerXaxis = 0
centerYaxis = 0
centerZaxis = 0
Yaw = 0
Pitch = 0
Roll = 0
Xaxis = 0
Yaxis = 0
Zaxis = 0
trackIR.update += update
if keyboard.getPressed(Key.K):
centerYaw = Yaw
centerPitch = Pitch
centerRoll = Roll
centerXaxis = Xaxis
centerYaxis = Yaxis
centerZaxis = Zaxis
Code: Select all
if trackIR.pitch > 80:
Roll = Pause
Yaw = Pause
if trackIR.pitch < -80:
Roll = Pause
Yaw = Pause
I though about using "centerRoll" and "centerYaw" which works, but is kinda messed up when going back to original position. So what I'd like to do is to freeze Yaw & Roll when looking above 80° up and down, then start sensing back these two imputs when going in-between 80/-80°...
Any ideas? Thanks a lot