Update (June 8, 2017): Detection Utilities functions are now best handled by the Interaction Engine (e.g. Camera-Facing Open Hand exists in example scripts in the Interaction Manager). Learn more on our blog.
With this week’s Unity Core Asset release, we’ve made a few changes to our Pinch Utilities – including some new features that extend its capabilities! These new utilities have been folded into the main Core Assets package, retiring the former Pinch Utility module.
So what are these new features? We call them Detectors, and they provide a convenient way to detect what a user’s hand is doing. In addition to detecting pinches, you can now detect when the fingers of a hand are curled or extended, whether a finger or palm is pointing in a particular direction, and whether the hand or fingertip are close to one of a set of target objects. (A grab detector is coming soon!)
What’s more, these detectors can be combined together using a Logic Gate. The Detector Logic Gate is itself a detector that logically combines two or more other detectors to determine its own state. Need a thumbs up gesture? Combine a thumb-extended detector with a thumb-pointing-upward detector using a logic gate.
Detectors dispatch standard Unity events when they activate or deactivate. This makes it easy to hook up objects and scripts to a detector straight from the Unity editor — without writing a line of code.
Each detector can draw gizmos that make it easy to see its configured conditions and whether it’s currently active or inactive.
Detectors are designed to be small building blocks that you can put together into something interesting. This also has the benefit that it is easy to write your own detector scripts.
You can find all the Detector scripts, including the PinchDetector, as part of the Unity Core Assets. Example scenes are located in the Detection Examples package, which also contains an additional scene that illustrates how to use detectors.