GlovePIE:WiiRWalking
From WiiLi
/* Wii R Walking v1.0 *********************************************************** * Created by Rhys Legault * * rhyslegault@hotmail.com * * Last Modified: February 19th, 2007 * *********************************************************** * Feel free to use, modify and redistribute this script * *********************************************************** * * About: * This script identifies if you are still, walking or running * * Requirements: 1 Wiimote * * Directions: * Throw the wiimote into you pocket and start walking or running * This can be around the room or on the spot it doesn't matter. * Just don't run into anything! * * The debug window will show that you are either still, walking or running * If required, adjust the threshold values to suit your needs. * * If you want to use this script inside of another script use the * Search->Replace tool and replace all Wiimote values to Wiimote2 * You won't be able to use any of the buttons the Wiimote while it's * in your pocket so you will require another Wiimote for any button * assignments * * Notes: * To protect your Wiimote you can put it into the original plastic packaging * of an additional Wiimote (not the Wiimote's packaging in the Wii bundle) * It fits perfectly & the buttons will not be pressed while you're running * */ //Amount of time between calculating movement status //1 = 25ms, 4 = 100ms, 5 = 125ms, 10 = 250ms, 20 = 500ms, 40 = 1000ms var.Timing = 20 //Threshold values for Walking & Running var.WalkingThreshold = 20 var.RunningThreshold = 60 //Sets the maxmium forces applied to the wiimote if abs(Wiimote.RelAccX) > var.MaxAccX then var.MaxAccX = abs(Wiimote.RelAccX) if abs(Wiimote.RelAccY) > var.MaxAccY then var.MaxAccY = abs(Wiimote.RelAccY) if abs(Wiimote.RelAccZ) > var.MaxAccZ then var.MaxAccZ = abs(Wiimote.RelAccZ) //Adust var.Timing if you want to change how often the TotalForce is calculated if (PIE.Frame % 40) % var.Timing = 0 //Calculates the total of the max forces applied to the wiimote var.TotalForce = var.MaxAccX + var.MaxAccY + var.MaxAccZ //Resets the max forces applied to the Wiimote var.MaxAccX = 0 var.MaxAccY = 0 var.MaxAccZ = 0 endif //Displays movement status if var.TotalForce < var.WalkingThreshold debug = "Still" elseif var.WalkingThreshold < var.TotalForce < var.RunningThreshold debug = "Walking" else debug = "Running" endif

