Hey guys,
I am using the PalmDirectionDetector to detect a palm down and up gesture. The detection works well attaching a script to my GameObject. However I am now trying to do this using code but I face an error when trying to attach a listener to OnActivate(). Is there something I am doing wrong? Btw, using the 3.2 version of the SDK that comes with Unity 5.5.0f3.
PalmDirectionDetector pdd; //class
public IHandModel rightHandModel; //HandModel
void Start () {
controller = new Controller();
pdd = new PalmDirectionDetector();
pdd.PointingType = PointingType.RelativeToHorizon;
pdd.Period = 0.1f;
pdd.OnAngle = 45;
pdd.OffAngle = 65;
pdd.HandModel = rightHandModel;
pdd.OnActivate.AddListener(p2); //This line causes an NullReferenceException saying this was not initalised.
}
private void p2()
{
Debug.Log("Detected!");
}