32 private float _handSeparationDistance = 0.23f;
33 private float _handHoldingDistance = 0.18f;
35 private void Reset() {
37 intCtrl = GetComponent<InteractionXRController>();
39 if (
intCtrl !=
null &&
intHand ==
null && this.transform.parent !=
null) {
40 intHand = this.transform.parent.GetChildren().Query()
42 .Where(h => h !=
null)
47 private void Update() {
54 var handControllerDistanceSqr = (handPos - ctrlPos).sqrMagnitude;
57 if (handControllerDistanceSqr > _handSeparationDistance * _handSeparationDistance) {
58 shouldIntHandBeEnabled =
true;
62 if (handControllerDistanceSqr < _handHoldingDistance * _handHoldingDistance) {
63 shouldIntHandBeEnabled =
false;
67 if (shouldIntHandBeEnabled && !
intHand.enabled) {
73 if (!shouldIntHandBeEnabled &&
intHand.enabled) {
This simple example script disables the InteractionHand script and has event outputs to drive hiding ...
UnityEvent OnInteractionHandEnabled
InteractionXRController intCtrl
UnityEvent OnInteractionHandDisabled
override Vector3 position
Gets the last-tracked position of the underlying Leap hand.
override bool isBeingMoved
Gets whether or not the underlying controller is currently being moved in world space,...
override bool isLeft
Gets whether the controller is a left-hand controller.
override Vector3 position
Gets the last-tracked position of the controller.
override bool isTracked
Gets whether or not the underlying controller is currently tracked and any joystick token filtering h...