赠你一套编码,先进游戏然后按小键盘的5,如果觉得角度不够按小键盘的+,反之是 - :
/*
This was Modified based on "PipoXYZ's 2Dof, 2Leds, Flight- and RaceScript."
Modifications:
1. "smooth()" was added;
2. var.Angle is initialized by 1200 instead of 200;
3. Beep when Pitch over 90 degree (at the edge of pitch in LockON)
4. Changed keys for sensitive and centerView
Keys:
NumPad- = Less Sensitive
NumPad+ = More Sensitive
NumPad5 = Set CenterView
Joystick2.button4 pressed = set var.Angle to 3000
Compatible with these games:
http://www.naturalpoint.com/trac ... nced-games-all.html
Emulates Yaw/Pitch
Setup:
Place your Wiimote near your monitor facing your head.
Wear two IR-leds on your head facing the Wiimote.
The leds can be attached to glasses, headphones, caps or something else.
*/
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 < 1200 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
if Joystick2.button4 <> true and var.Angle > 1200 then
var.Angle = 1200
endif
if Joystick2.button4 then //if Joystick1.button14 then
var.Angle = 3000
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 pressed(NumPad5) 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 "居中"
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
if var.TempDot1x < var.TempDot2x then
var.TempX = (Wiimote.Dot2x - Wiimote.Dot1x) / 2
else
var.TempX = (Wiimote.Dot1x - Wiimote.Dot2x) / 2
endif
if var.TempDot1y < var.TempDot2y then
var.TempY = (Wiimote.Dot2y - Wiimote.Dot1y) / 2
else
var.TempY = (Wiimote.Dot1y - Wiimote.Dot2y) / 2
endif
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
endif
endif
//smoothing
var.TrackIRYawOld = var.FakeTrackIRYaw
var.TrackIRPitchOld = var.FakeTrackIRPitch
var.FakeTrackIRYaw = ensureMapRange(var.X, var.MaxIRX, var.MinIRX , -360, 360)
var.FakeTrackIRPitch = ensureMapRange(var.Y, var.MinIRY, var.MaxIRY , -360, 360)
var.DiffX = max(var.TrackIRYawOld,var.FakeTrackIRYaw) - min(var.TrackIRYawOld,var.FakeTrackIRYaw)
if var.DiffX < 10 then
FakeTrackIR.Yaw = smooth(var.FakeTrackIRYaw,30)
//FakeTrackIR.Yaw = smooth(smooth(var.FakeTrackIRYaw,30),30)
//FakeTrackIR.Yaw = kalman(smooth(var.FakeTrackIRYaw,30),0.4,0.04)
//FakeTrackIR.Yaw = smooth(kalman(var.FakeTrackIRYaw,0.4,0.03),30)
endif
var.DiffY = max(var.TrackIRPitchOld,var.FakeTrackIRPitch) - min(var.TrackIRPitchOld,var.FakeTrackIRPitch)
if var.DiffY < 10 then
FakeTrackIR.Pitch = 1.5 * smooth(var.FakeTrackIRPitch,30)
//FakeTrackIR.Pitch = smooth(smooth(var.FakeTrackIRPitch,30),30)
//FakeTrackIR.Pitch = kalman(smooth(var.FakeTrackIRPitch,30),0.4,0.04)
//FakeTrackIR.Pitch = smooth(kalman(var.FakeTrackIRPitch,0.4,0.03),30)
endif