Unity XR Controller Input Data Provider
There are three concrete XRControllerCondition implementations: ButtonActionXRControllerCondition This is probably the most commonly used condition for triggering hand poses, it is fulfilled when a specified XR controller button is pressed or touched. When exactly will it be fulfilled is configured via two properties:
XRControllerButton Button { get; set; }
- Specifies which XR controller button should be checked
XRControllerButtonAction Action { get; set; }
- Specifies an action that should be performed with the controller button in order for the condition to evaluate to true - it can be either Press or Touch
BinaryXRControllerCondition
As briefly mentioned before, this condition consists of two XRControllerCondition's that could be viewed as the binary condition's child conditions. When binary condition is being evaluated, it will recursively evaluate its child conditions (call their Evaluate methods) and combine their evaluation results with a boolean logical operation that can be specified via property. Operation can be AND, OR or XOR. In addition to that, binary condition will also aggregate button values resulting from its child conditions in order to output the final button value. Aggregation method can also be specified via property and it can be set to one of several values - use button value from the binary condition's left child condition and ignore the other one's or vice-versa, or use one of the math functions on the two button values: average, maximum or minimum. Properties of the BinaryXRControllerCondition: XRControllerCondition Condition1 { get; set; }
- The first condition nested in the binary condition, or binary condition's left child condition
- Null value is not allowed
BooleanBinaryOp Op { get; set; }
- The binary boolean logic operation to perform between the evaluation results of the binary condition's child conditions when the binary condition is being evaluated
XRControllerCondition Condition2 { get; set; }
- The second condition nested in the binary condition, or binary condition's right child condition
- Null value is not allowed
BinaryXRControllerConditionButtonValueCombine ButtonValueCombine { get; set; }
- Specifies how should the binary condition combine the button values resulting from evaluations of its child conditions in order to arrive to the final button value Binary condition is a very powerful construct, it is essentially what allows for specifying complex conditions that should be fulfilled in order to trigger different hand skeleton poses in the context of a UnityXRControllerInputDataProvider. For example, if you want to trigger some specific hand pose when primary XR controller button is being touched, but only if the grip button is pressed, you would set BinaryXRControllerCondition to the corresponding XRControllerPoseTrigger's Condition (or choose the Binary value for the pose trigger's ConditionType in Unity editor), then set a ButtonActionXRControllerCondition instance for binary condition's Condition1 and also repeat the same for the binary condition's Condition2 (again, if you want to do this via editor UI, just choose ButtonAction for the ConditionType1 and ConditionType2 properties under the binary condition's UI section). After that you just need to configure Condition1 and Condition2: for Condition1 set Button to Primary and Action to Touch, for Condition2 set Button to Grip and Action to Press. Finally set the binary condition's Op to And and choose whichever value you want for ButtonValueCombine. That is how you would define the given condition for triggering desired hand pose. This was still relatively simple example. With the combination of all different types of conditions, the ability to nest them inside binary conditions (including other binary conditions as well) and Invert property of a condition you can define any kind of button state-based condition with very complex logic behind it.
ConstantXRControllerCondition
The most simple type of XRControllerCondition. It always evaluates to true, i.e. its EvaluateCore method always returns true and for button value outputs 1. Consequently, if its Invert property is set to true, it always evaluates to false. Note however that for button value it will still output 1.
Custom XR controller condition
While you can can certainly implement your own XRControllerCondition and then use it in the context of a UnityXRControllerInputDataProvider, you will not be able to set it via Unity editor UI to a pose trigger's Condition or a binary condition's Condition1 or Condition2 because of the previously mentioned ways of setting those properties (via ConditionType). This is because of the Unity editor's restrictions imposed when dealing with references to abstract classes. In future versions of OctoXR this may be implemeneted in some more advanced way to allow for setting those properties using editor UI, but for now, you will only ever going to be able to set them to your own condition type via code.