Wiimote2quest3D - Beuth Hochschule für Technik Berlin
Transcription
Wiimote2quest3D - Beuth Hochschule für Technik Berlin
Godbersen Wiimote2Quest3D (wiimote2Quest3D.doc,18.09.2007) 1/7 Wiimote2quest3D Applikation Wiimote Blue Soleil GlovePIE PPjoy Bluetooth Human Interface Device Service DirectInput Windows OS Bluetooth Vorbereitung • • • Systemsoftware: PPjoy Systemsteuerung ( Parallel Port Joysticks XP-Apps: Blue Soleil, GlovePIE, Kallibrierung: Systemsteuerung ( Gamecontroler Startsequenz • • • • BlueSoleil starten Bluetooth Dienste Aktualisieren Wiimote 1&2 gedrückt halten, so dass LEDs leuchten, hält 20 sec, wiederholen Verbinden ( Human Interface Device Service. Erfolg: Rückkopplung Grün • • • • GlovePIE starten Sound off ??? XXX.PIE laden und Starten Quest3D App. laden und starten (ggf. Joystick Nr aktualisieren) Godbersen Wiimote2Quest3D (wiimote2Quest3D.doc,18.09.2007) 2/7 Einführung in Glovepie und PPjoy: • GlovePIE_PPjoy.doc GlovePie Variablen Typischerweise Bindung angeben Var.XXX Wiimote.XXX PPjoy.XXX Var optional, aber für die Ausgabe zu Testzwecken wichtig. In GlovePIE sichtbare Wiimote-und Nunchuck-Variablen Count HasNunChuk HasClassic Expansion Wiimote.XXX Wiimote1.XXX Wiimote2.XXX … Nunchuk.XXX 1,2,.. binary 0,2,3 Binary In Up, Down, Left, Right, A, B, Minus, Home, Plus, One, Two. Anzahl der erkannten Wiimotes To tell whether a Nunchuk controller is plugged in or classic 0 means none, 2 Nunchuk, 3 Classic Controller. Winmote ansprechen (falls nur einer da) Differenziert einen spezifischen Wiimote aus einem Set ansprechen zugehörigen Nunschuk ansprechen, z.B. Wiimote.Nunchuk.XXX Buttons, CButton ZButton dot1vis … dot4vis binary Binary Out Led1, … Led4 Leds Rumble Speaker binary 0 ..15 binary binary Mute binary (Power button, Sync button (hidden under the battery compartment) not implemented) Nunchuck only. NOTE: Unlike a playstation controller, pushing in the joystick is not a button. tell whether an infra-red dot can be seen Set LED individually Force Feedback Setting speaker to true switches on the speaker (slowly) and setting it to false switches off. Speaker. Setting Mute to true mutes the speaker, and setting it to false un-mutes it. works faster than using “Speaker”. Note that you don’t need to turn the speaker on if you set the frequency, Godbersen Wiimote2Quest3D (wiimote2Quest3D.doc,18.09.2007) 3/7 because setting the frequency to non-zero does it automatically. Turning sound on and off with mute is also faster than doing it by changing the frequency to 0. Analog In Accelleration gx, gy, gz g g RawAccX, RawAccY, and RawAccZ. m/s/s RelAccX, RelAccY, RelAccZ RawForceX, …. Rotations Pitch, Roll SmoothPitch, SmoothRoll RotMat IR Sensor dot1x, dot1y … dot4x, dot4y dot1size … dot4size Nunchuk JoyX, JoyY grad grad All these acceleration values are relative to the Wiimote’s orientation. So Z is wherever the Wiimote is pointing, not necessarily a fixed direction. Nunchuk accelerometers have higher precision and lower range than Wiimote They can be zero for no force/acceleration, 1 for the same amount of force/acceleration as gravity, or any value in between or outside that range. (-1, 0, +1) bei normalem g, bis 3 fach Vector version of gx, gy, gz GlovePIE supports units so you can do things like this: RawAccX in miles per hour per second to get the value in different units. The RawAcc values still include gravity. Real acceleration without gravity. They are not very accurate because it is hard for GlovePIE to separate out the force of gravity, but it makes a good attempt. depreciated The angles are all in degrees. Pitch is the vertical angle. It is 90 when the wiimote is pointing at the ceiling, -90 when it is pointing at the ground, 0 when it is flat, and a value in between for angles in between. Roll is how much the top is tilted towards the right. It is -180 or +180 when the Wiimote is upside-down, -90 when it is on its left side, +90 when it is on its right side. and 0 when it is flat. Pitch and Roll attempt to filter out accelerations. This may make them slightly jagged. You can use SmoothPitch and SmoothRoll if you don’t mind getting the wrong result if the wiimote moves, but you do want it to be smooth. It is a 3x3 Direct3D style rotation matrix read the position of the infra-red dots that the Wiimote can see (derzeit nur 2 LED) tell the size of a dot (between 0 and 15), always 16 with Nunchuk or Expansion! Nunchuck only: JoyX is -1 to the left, 0 in the middle, and +1 to the right. JoyY is -1 up, 0 in the middle, and +1 down. same values used by PPJoy. Godbersen Wiimote2Quest3D (wiimote2Quest3D.doc,18.09.2007) 4/7 Analog Out Speaker Frequency Hz Volume 0 ..2 SampleRate Speaker. If you set Frequency to 0 it will switch the speaker off. If you set it to non-zero it will switch the speaker on again. set the speaker volume to a value between 0% and 200%. recommended max 1 Default 3640 Hz. Battery Ladezustand PPJoy If you want to emulate a joystick with PIE, you need to download and install PPJoy. Download it from ttp://www.geocities.com/deonvdw/PPJoy.htm You then need to configure PPJoy to add a virtual joystick or two. Go to “Parallel Port Joysticks” in Control Panel (or the CP-Settings menu of GlovePIE), and choose “Add”. Then under “Parallel Port” choose “Virtual joystick” and under “Controller Number” choose a number between 1 and 16, which will be the number of the Virtual Joystick. It’s best to start with 1. Then you need to create a custom mapping for the virtual joystick. Choose • the number of Axes (I recommend 8), • the number of buttons (I recommend 32), and • the number of POV hats (I recommend 2). Then you need to set which axes you want the 8 available axes to be. Then click next and choose which analog axes you want to correspond to those axes. The analog values are how you set that axis in PIE, just choose any numbers here, but remember them later. I recommend using analog 0 to analog 7. Then click next. Then choose which digital values you want to correspond to the first 16 buttons. I recommend 0 to 15. Then click next and set the next 16. Then set the two POV hats. Once you have a Virtual Joystick set up in PPJoy, you can set its analog and digital values with PIE: PPJoy1.analog0 = 0.5 PPJoy1.digital0 = true Analog values can be between -1 and 1. Digital values can be either true or false. If you want to set “PPJoy Virtual Joystick 2” then set the values for PPJoy2. Godbersen Wiimote2Quest3D (wiimote2Quest3D.doc,18.09.2007) 5/7 “PPJoy” by itself without a number refers to “PPJoy Virtual Joystick 1”. If the analog corresponds to an axis, then 0 is centred and -1 and 1 are the two extremes. But if the analog corresponds to a a POV hat switch, then -1 corresponds to pushed at an angle of 0 degrees (forwards). -0.5 corresponds to 90 degrees (right). 0 corresponds to 180 degrees (backwards), 0.5 corresponds to 270 degrees (left) and 1 corresponds to centred. Games which let you choose which joystick you use will need to be set to the appropriate PPJoy Virtual Joystick in the game. Other games which just use the default Joystick will require you to go to the Control Panel joystick settings (Use GlovePIE’s CP-Settings menu to get there quickly), and change the default joystick there. If you want to control the game with a real joystick and just add some scripted actions to it, you will set the game or control panel to the virtual joystick and assign values from the real joystick to the PPJoy fields. Steuerdateien: a) Diagnostik b) B) Quest3D Anschluss (Betrieb als Gamecontroller/ normaler Joystick // TestWiimote-all-2.PIE // Gibt im Variablen-Tab alle angesprochenen Werte , auch von Nunchuk, aus. // Nur für Test geeignet //Godbersen 2007 06 22 // Set keys to wiimote/nunchuk buttons var.Up = Wiimote.Up or Wiimote.Classic.Up var.Down = Wiimote.Down or Wiimote.Classic.Down var.Left = Wiimote.Left or Wiimote.Classic.Left var.Right = Wiimote.Right or Wiimote.Classic.Right var.A = Wiimote.A or Wiimote.Classic.a var.B = Wiimote.B or Wiimote.Classic.b //var.C = Wiimote.Nunchuk.CButton var.One = Wiimote.One var.Two = Wiimote.Two var.Home = Wiimote.Home or Wiimote.Classic.Home var.Minus = Wiimote.Minus or Wiimote.Classic.Minus var.NumPadPlus = Wiimote.Plus or Wiimote.Classic.Plus X = Wiimote.Classic.x Y = Wiimote.Classic.y //var.Z = Wiimote.Nunchuk.ZButton or Wiimote.Classic.ZL or Wiimote.Classic.ZR L = Wiimote.Classic.L R = Wiimote.Classic.R // Set PPJoy Virtual Joystick to nunchuk joystick //var.PPJoy.Analog0 = Wiimote.Nunchuk.JoyX //var.PPJoy.Analog1 = Wiimote.Nunchuk.JoyY // Rumble when shift is pressed Godbersen Wiimote2Quest3D (wiimote2Quest3D.doc,18.09.2007) 6/7 Wiimote.Rumble = Shift // Set the middle two LEDs to ON Wiimote.Led1 = false Wiimote.Led2 = true Wiimote.Led3 = true Wiimote.Led4 = false // Show the IR dots as fake cursors var.Cursor1.Visible = Wiimote.dot1vis Var.IRsize1 = Wiimote.dot1size Var.IRsize2 = Wiimote.dot2size Var.IRsize3 = Wiimote.dot3size Var.IRsize4 = Wiimote.dot4size var.Cursor1x = Wiimote.dot1x / 1023 var.Cursor1y = Wiimote.dot1y / 1023 var.Cursor2.Visible = Wiimote.dot2vis var.Cursor2x = Wiimote.dot2x / 1023 var.Cursor2y = Wiimote.dot2y / 1023 var.Cursor3.Visible = Wiimote.dot3vis var.Cursor3x = Wiimote.dot3x / 1023 var.Cursor3y = Wiimote.dot3y / 1023 var.Cursor4.Visible = Wiimote.dot4vis var.Cursor4x = Wiimote.dot4x / 1023 var.Cursor4y = Wiimote.dot4y / 1023 // Check expansion var.wii_gx = Wiimote.gx Var.wii_gy = Wiimote.gy Var.wii_gz = WIimote.gz // Show expansion and wiimote forces debug = var.Expansion+'; Bat='+Wiimote.Battery+'; Pitch='+RemoveUnits(Wiimote.Pitch)+' Roll='+RemoveUnits(Wiimote.Roll)+'; '+Wiimote.RelAccX+', '+Wiimote.RelAccY+', '+Wiimote.RelAccZ Godbersen Wiimote2Quest3D (wiimote2Quest3D.doc,18.09.2007) 7/7 // WiiTestGodbersen.PIE //Generic Joystick Driver Modifiziert godbersen 20070620 //by vkapadia //[email protected] // //In PPJoy, set a Virtual Joystick to have at least 2 axes and 11 buttons. //Number the axes Analog0 and Analog1 and the buttons Digital0 through Digital10 // //In your game go into the control setup and map the keys to whatever you'd like. PPJoy.Digital0 = wiimote.Up PPJoy.Digital1 = wiimote.Down PPJoy.Digital2 = wiimote.Left PPJoy.Digital3 = wiimote.Right PPJoy.Digital4 = Wiimote.A PPJoy.Digital5 = Wiimote.B PPJoy.Digital6 = Wiimote.Minus PPJoy.Digital7 = Wiimote.Plus PPJoy.Digital8 = Wiimote.Home PPJoy.Digital9 = wiimote.One PPJoy.Digital10 = wiimote.Two PPJoy.Analog0 = (wiimote.gx +0)* 1 PPJoy.Analog1 = (wiimote.gy +0) *1 PPJoy.Analog2 = (wiimote.gz +0)*1 debug = "X= "+Wiimote.gx+' Y= '+Wiimote.gy+' Z= '+Wiimote.gz //debug = "X= "+WIimote.Nunchuk.gx+' Y= '+Wiimote.Nunchuk.gy+' '+Wiimote.Nunchuk.gz Mappings Wiimote- GlovePIE GlovePIE-PPjoy Beispiel: PPJoy.Analog0 = wiimote.gx Kalibrierung • Systemsteuerung Æ Gamecontroller Æ Quest3D Applikation • Wii-racetrack.cgr (2 Achsen, 1 Schalter) Ausblick: Ein dedizierter Wii-Channel wird in Quest3D V.4 enthalten sein. Z=