GlovePIE FPS Script without SensorBar

hellu :) this is a script for control fps games without sensorbar (a bit difficult but.. just try it). Rember to read the comments for calibrate your wiimote with the script. enjoy it them.

————————————————–

// FPSGame by Kasten, improved by Lotti
// Thanks to TaggeD for the automatic configuration of the wiimote’s offsets

// Motion Mouse
// Manual Configuration
// When configuring the offsets please put the wiimote flat and do not move it.
// These are offsets change them so that your debug output reads 0,28,0
// The debug output is at the top of this window.
// Ex if you get -7,33,-6 then change the offsets to 7,-5,6

var.xNunchukOffset = 5
var.yNunchukOffset = -3
var.zOffset = 4

var.xRot = Wiimote.RawForceX + var.xNunchukOffset
var.yRot = Wiimote.RawForceY + var.yNunchukOffset
var.zRot = Wiimote.RawForceZ + var.zOffset

debug = ‘X:’ + var.xRot + ‘, ‘ + ‘Y:’ + var.yRot + ‘, ‘ + ‘Z:’ + var.zRot

// Automatic Configuration
// Simple press – and + buttons on wiimote before start playing

if Wiimote.Minus && Wiimote.Plus then
var.xNunchukOffset = -Wiimote.RawForceX
var.zOffset = -Wiimote.RawForceZ
var.yNunchukOffset = -Wiimote.RawForceY + 28
endif

// Change this if you would like your mouse to go faster
var.xMinSpeed = 1
var.xMaxSpeed = 5
var.xSpeedDivision = 27 //default 27
var.zMinSpeed = 1
var.zMaxSpeed = 5
var.zSpeedDivision = 27 //default 27

// change these to a higher number if your hands are not steady or lower if they are
var.xCutoff = 4
var.zCutoff = 4

// X/Y offsets for Analog. If it’s too sensitive then make the numbers larger.
var.xNunchukOff = .07
var.yNunchukOff = .07

//Switch off the leds
Wiimote.leds = 0

//
// Game buttons.
//

mouse.LeftButton = Wiimote.B
mouse.RightButton = Wiimote.A
mouse.WheelUp = Wiimote.Plus
mouse.WheelDown = Wiimote.Minus
mouse.WheelUp = Wiimote.Right
mouse.WheelDown = Wiimote.Left
key.Escape = Wiimote.Two

key.e = Wiimote.Down
key.Space = Wiimote.Up
key.q = Wiimote.Nunchuk.CButton
key.Shift = Wiimote.Nunchuk.ZButton

//
// Analog Movements
//

if Wiimote.Nunchuk.JoyX < -var.xNunchukOff then key.a = true else key.a = false endif if Wiimote.Nunchuk.JoyX > var.xNunchukOff then
key.d = true
else key.d = false
endif
if Wiimote.Nunchuk.JoyY < -var.yNunchukOff then key.w = true else key.w = false endif if Wiimote.Nunchuk.JoyY > var.yNunchukOff then
key.s = true
else key.s = false
endif

//
// Reload
//

if Wiimote.Nunchuk.RawForceY > 60 then
key.r = true
Wiimote.Rumble = true
Wiimote.Leds = 15
else
key.r = false
Wiimote.Rumble = false
Wiimote.Leds = 0
endif

// This is the code that moves your mouse
var.xSpeedInc=(var.xMaxSpeed-var.xMinSpeed)/var.xSpeedDivision
var.zSpeedInc=(var.zMaxSpeed-var.zMinSpeed)/var.zSpeedDivision

var.xSpeed=var.xMinSpeed+abs(var.xRot)*var.xSpeedInc
var.zSpeed=var.zMinSpeed+abs(var.zRot)*var.zSpeedInc

if var.xRot > var.xCutoff then mouse.x = mouse.x – .001 * var.xSpeed * (var.xRot – var.xCutoff)
if var.xRot < -var.xCutoff then mouse.x = mouse.x - .001 * var.xSpeed * (var.xRot + var.xCutoff) if var.zRot > var.zCutoff then mouse.y = mouse.y – .001 * var.zSpeed * (var.zRot – var.zCutoff)
if var.zRot < -var.zCutoff then mouse.y = mouse.y - .001 * var.zSpeed * (var.zRot + var.zCutoff) //debug = ‘X:’ + var.xRot + ‘, ‘ + ‘Z:’ + var.zRot

Leave a Reply

Your email address will not be published. Required fields are marked *