In this Instruction we are going to modify WiimoteLib by including a new event trigger that is activated upon a change in either Quad or Zone value.
This is a very useful addition that allows for “singular” triggering so that you don’t have to rely on “flag checks” within the standard WiimoteState loop and thus allowing the Libary to do all the work!
Before we start, this instruction assumes you have previously completed the Areas Quad and Zone Instruction.
Start off by opening up the Events.cs file and add the following code below the public class WiimoteChangedEventArgs: Read..
Here we have another step down the path towards full Balance Board Orientation. This time out we are going to merge the Quadrant and Quadzone functionality into a new collective known as “Area” (for want of a better name).
Please note that this instruction assumes familiarity with the Quadrant and Quadzone instructions.
Similar to the Grouping GOG instruction we are going to start by modifying the DataTypes.cs fileĀ by grouping the two existing definitions by grouping them together in a new struct.
Replace both the Quadrant and Quadzone definitions with the following singular block of code:
/// <summary>
/// Area of most Weight/COG
/// </summary>
[DataMember]
public Area Area;
Next we are going to add the new struct so that we can use this definition. Below the BalanceBoardState struct add the following code: Read..
There are times when using the WiiFit Balance Board with WiimoteLib that I find it useful to have direct access to which particular “Zone” currently has focus (most weight or COG applied), just think WiiFit areobics etc. Output is fed back as a string which can then be used as desired eg in a switch or if statement etc.
Here’s how its done:
First of all open up Data Types.cs and add the following code block within the BalanceBoardState struct:
/// <summary>
/// Current Balance Board Zone
/// </summary>
[DataMember]
public string Quadzone;
Next open up Wiimote.cs and locate the parse extension function. For convenience sake the following block shorthands the values included with WiimoteLib to help with RSI. Add the following code below the existing COG code just above the break: Read..
There are times when using the WiiFit Balance Board with WiimoteLib that I find it useful to have direct access to which particular “Quadrant” currently has focus (most weight or COG applied), as with the Quadzone Filter just think WiiFit areobics etc.
When used in conjunction with the Quadzone Filter you have the basic tools needed for very simple forms of navigation. As with the Quadzone filter, output is fed back as a string which can then be used as desired eg in a switch or if statement etc.
So without further ado heres how its done:
First of all open up Data Types.cs and add the following code block within the BalanceBoardState struct:
/// <summary>
/// Current Balance Board Quadrant, SJB
/// </summary>
[DataMember]
public string Quadrant;
Next open up Wiimote.cs and locate the parse extension function. For convenience sake the following block shorthands the values included with WiimoteLib. The code is the same as that used in the Quadzone tutorial so if you have already implemented it there you can skip this step, otherwise add the following code below the existing COG code just above the break: Read..