The pressure sensor and how to use it
(Updated 11 november 2016)
Interpreting the pressure of a Pillo is one of the three features of a Pillo controller. The sensor translates the pressure on the Pillo into decimal numbers between 0 and 1. In order to retrieve the pressure value of a Pillo you need to use the GetPressure function and read it out from a variable.
Parameters:
GetPressure(PilloID)
PilloID: the ID of the player to get the pressure of.
// Gets the current pressure value of the pillo with the matching Pillo id. // the value is a float between 0 and 1. using UnityEngine; using Pillo; using System.Collections; public class GetPressureExample : MonoBehaviour { public PilloID pilloID1; private float pressureP1; void Update() { pressureP1 = PilloController.GetPressure(pilloID1); if(pressureP1 > 0) //if the Pillo is pressed { //Do something here /* * Note: If you put print(PressureP1); here it will stop printing once the value is 0 * and only show the last value above the 0. Keep this in mind when using this function! */ } print(pressureP1); } }
If you would like to know how to use this function in a game, please take a look at this tutorial.