if starting then
wait 200 ms
PIE.FrameRate = 100Hz
if Wiimote.dot2vis = true then
var.XOffset = (Wiimote.Dot1x + Wiimote.Dot2x) / 2
var.YOffset = (Wiimote.Dot1y + Wiimote.Dot2y) / 2
else
var.XOffset = Wiimote.Dot1x
var.YOffset = Wiimote.Dot1y
endif
var.Angle = 1200
endif
//Sensitivity
if pressed(NumPadMinus) and var.Angle < 3000 then
var.Angle = var.Angle + 50
say (var.Angle)
else
var.Angle = var.Angle
endif
if pressed(NumPadPlus) and var.Angle > 50 then
var.Angle = var.Angle - 50
say (var.Angle)
else
var.Angle = var.Angle
endif
//Maprange
var.MinIRX = var.XOffset - var.Angle
var.MaxIRX = var.XOffset + var.Angle
var.MinIRY = var.YOffset - var.Angle
var.MaxIRY = var.YOffset + var.Angle
//Center View
if NumPad5 || Joystick2.Button2 then
if Wiimote.dot2vis = true then
var.XOffset = (Wiimote.Dot1x + Wiimote.Dot2x) / 2
var.YOffset = (Wiimote.Dot1y + Wiimote.Dot2y) / 2
else
var.XOffset = Wiimote.Dot1x - var.TempX
var.YOffset = Wiimote.Dot1y - var.TempY
endif
say "center"
endif
//Mapset
if Wiimote.dot2vis = true then
var.TempDot2x = Wiimote.Dot2x
var.TempDot1x = Wiimote.Dot1x
var.TempDot2y = Wiimote.Dot2y
var.TempDot1y = Wiimote.Dot1y
var.X = (Wiimote.Dot1x + Wiimote.Dot2x) / 2
var.Y = (Wiimote.Dot1y + Wiimote.Dot2y) / 2
var.TempX = abs(Wiimote.Dot1x - Wiimote.Dot2x) / 2
var.TempY = abs(Wiimote.Dot1y - Wiimote.Dot2y) / 2
var.dotCount=2
else
if var.TempDot1x < var.TempDot2x then
var.X = Wiimote.Dot1x + var.TempX
else
var.X = Wiimote.Dot1x - var.TempX
endif
if var.TempDot1y < var.TempDot2y then
var.Y = Wiimote.Dot1y + var.TempY
else
var.Y = Wiimote.Dot1y - var.TempY
var.dotCount=1
endif
endif
//smoothing
var.FakeTrackIRYaw = ensureMapRange(var.X, var.MaxIRX, var.MinIRX , -180, 180)
var.FakeTrackIRPitch = ensureMapRange(var.Y, var.MinIRY, var.MaxIRY , -180, 180)
var.accelerateYaw = abs(var.FakeTrackIRYaw) * var.FakeTrackIRYaw * 0.30
var.acceleratePitch = abs(var.FakeTrackIRPitch) * var.FakeTrackIRPitch * 0.25
var.FakeTrackIRYaw = sign(var.FakeTrackIRYaw) * min(abs(var.accelerateYaw), abs(var.FakeTrackIRYaw * 2)) + var.FakeTrackIRYaw * 0.5
var.FakeTrackIRPitch = sign(var.FakeTrackIRPitch) * min(abs(var.acceleratePitch), abs(var.FakeTrackIRPitch * 2)) + var.FakeTrackIRPitch * 0.5
var.FakeTrackIRYaw = EnsureRange(var.FakeTrackIRYaw, -170, 170)
var.FakeTrackIRPitch = EnsureRange(var.FakeTrackIRPitch, -90, 90)
var.FakeTrackIRYaw = smooth(var.FakeTrackIRYaw,60)
var.FakeTrackIRPitch = smooth(var.FakeTrackIRPitch,60)
FakeTrackIR.Yaw = var.FakeTrackIRYaw
FakeTrackIR.Pitch = var.FakeTrackIRPitch
debug = var.Angle + ' Battery=' + Wiimote.Battery + ' Yaw=' + FakeTrackIR.Yaw + ' Pitch=' + FakeTrackIR.Pitch |