public void OnClick(HandInput Source) { var selectedObjects = UIManager.Instance.GetSelectedObjects(); foreach (var item in selectedObjects) { var rigidbody = item.GetComponent<Rigidbody>(); if (rigidbody != null) rigidbody.AddForce(new Vector3(-100f, 0, 0)); else item.transform.Translate(-0.1f, 0, 0); } }
void CollectInput(ref HandPose hand, ref ControllerPose controller, ref HandInput i) { i.handTrigger = hand.gripFlex; i.previousIndexTrigger = i.indexTrigger; i.indexTrigger = hand.indexFlex; if (i.indexTrigger >= IndexThreshold && i.previousIndexTrigger < IndexThreshold) { i.indexPressFrame = context.renderFrame; } i.isPointing = true; i.isPressingX = controller.button1IsDown; i.isPressingY = controller.button2IsDown; i.stick = controller.joystickPosition; }
public void UnregisterDeviceAngularVelocityNotify(HandInput handInput, Action <Vector3> notify) { deviceAngularVelocityNotifies[(int)handInput].Remove(notify); }
public void RegisterDeviceVelocityNotify(HandInput handInput, Action <Vector3> notify) { deviceVelocityNotifies[(int)handInput].Add(notify); }
public void UnregisterDeviceRotationNotify(HandInput handInput, Action <Quaternion> notify) { deviceRotationNotifies[(int)handInput].Remove(notify); }
public void RegisterTriggerCanceledNotify(HandInput handInput, Action notify) { triggerCanceledNotifies[(int)handInput].Add(notify); }
void Awake() { player = GameObject.Find("Player").GetComponent <PlayerBehaviour>(); playerHand = GameObject.Find("PlayerHand").GetComponent <HandBehaviour>(); handBoard = playerHand.GetComponent <HandInput>(); }
public HandsState(Body body) { CameraSpacePoint handLeft = body.Joints[JointType.HandLeft].Position; CameraSpacePoint handRight = body.Joints[JointType.HandRight].Position; wristLeft = body.Joints[JointType.WristLeft].Position; wristRight = body.Joints[JointType.WristRight].Position; CameraSpacePoint spineBase = body.Joints[JointType.SpineBase].Position; input = new HandInput(); input.isLeftGrip = (body.HandLeftState == HandState.Closed); input.isRightGrip = (body.HandRightState == HandState.Closed); //select wrist if (prime_hand) { primeHandy = (int)(wristRight.Y * 100); isRight = true; } else { primeHandy = (int)(wristLeft.Y * 100); isRight = false; } //set left hand position float leftDepth = spineBase.Z - handLeft.Z; input._LPressExtent = (leftDepth - TOUCH_REGION) / (EMBED_REGION - TOUCH_REGION); if (leftDepth > EMBED_REGION) { LeftHandPosition = HandPositionZ.EMBED; } else if (leftDepth > TOUCH_REGION) { LeftHandPosition = HandPositionZ.TOUCH; } else { LeftHandPosition = HandPositionZ.UNKNOW; } //set right hand position float rightDepth = spineBase.Z - handRight.Z; input._RPressExtent = (rightDepth - TOUCH_REGION) / (EMBED_REGION - TOUCH_REGION); if (rightDepth > EMBED_REGION) { RightHandPosition = HandPositionZ.EMBED; } else if (rightDepth > TOUCH_REGION) { RightHandPosition = HandPositionZ.TOUCH; } else { RightHandPosition = HandPositionZ.UNKNOW; } //set left hand state LeftHandState = body.HandLeftState; //set right hand state RightHandState = body.HandRightState; //no hand if (LeftHandPosition == HandPositionZ.UNKNOW && RightHandPosition == HandPositionZ.UNKNOW) { operation = Operation.no_operation; input._isWhich = 0; } //single hand else if (LeftHandPosition == HandPositionZ.UNKNOW || RightHandPosition == HandPositionZ.UNKNOW) { //left hand operate if (LeftHandPosition != HandPositionZ.UNKNOW) { SelectHandPosition = LeftHandPosition; SelectHandState = LeftHandState; input._isWhich = 1; isRight = false; } //right hand operate else { SelectHandPosition = RightHandPosition; SelectHandState = RightHandState; input._isWhich = 2; isRight = true; } //single hand touch region if (SelectHandPosition == HandPositionZ.TOUCH) { if (SelectHandState == HandState.Closed) { if (mouse_click_region) { operation = Operation.left_down; } else { operation = Operation.right_down; } } else { operation = Operation.move; } } //single hand embed region else { if (SelectHandState == HandState.Closed) { if (mouse_click_region) { operation = Operation.right_down; } else { operation = Operation.left_down; } } else { operation = Operation.move; } } } else { //two hand closed will operate wheel input._isWhich = 3; if (LeftHandState == HandState.Closed && RightHandState == HandState.Closed) { if (middle_button_and_wheel) { operation = Operation.wheel; } else { operation = Operation.middle_down; } } //one hand closed else if (LeftHandState == HandState.Closed || RightHandState == HandState.Closed) { if (middle_button_and_wheel) { operation = Operation.middle_down; } else { operation = Operation.wheel; } } else { operation = Operation.move; } } }
public void UnregisterPrimaryButtonTouchedNotifies(HandInput handInput, Action notify) { primaryButtonTouchedNotifies[(int)handInput].Remove(notify); }
public void UnregisterThumbstickDirectionNotify(HandInput handInput, Action <Vector2> notify) { thumbstickDirectionNotifies[(int)handInput].Remove(notify); }
public void UnregisterThumbstickTriggeredNotify(HandInput handInput, Action notify) { thumbstickTriggeredNotifies[(int)handInput].Remove(notify); }
public void RegisterThumbstickTriggeredNotify(HandInput handInput, Action notify) { thumbstickTriggeredNotifies[(int)handInput].Add(notify); }
public void UnregisterTriggerStrengthNotify(HandInput handInput, Action <float> notify) { triggerStrengthNotifies[(int)handInput].Remove(notify); }
public void UnregisterTriggerCanceledNotify(HandInput handInput, Action notify) { triggerCanceledNotifies[(int)handInput].Remove(notify); }
public void UnregisterGripTriggeredNotify(HandInput handInput, Action notify) { gripTriggeredNotifies[(int)handInput].Remove(notify); }
public void RegisterGripCanceledNotify(HandInput handInput, Action notify) { gripCanceledNotifies[(int)handInput].Add(notify); }
public void RegisterPrimaryButtonTriggeredNotifies(HandInput handInput, Action notify) { primaryButtonTriggeredNotifies[(int)handInput].Add(notify); }
/// <summary> /// Copy hand input content from another instance. /// </summary> /// <param name="hi">Source hand input instance</param> public void Copy(HandInput hi) { hi.content.CopyTo(content, 0); }
public void RegisterSecondaryButtonTouchedNotifies(HandInput handInput, Action notify) { secondaryButtonTouchedNotifies[(int)handInput].Add(notify); }
void TranslateHandPoseToInput(ref OvrAvatarDriver.HandPose handPose, ref OvrAvatarDriver.ControllerPose controllerPose, ref HandInput input) { input.handTrigger = handPose.gripFlex; input.previousIndexTrigger = input.indexTrigger; input.indexTrigger = handPose.indexFlex; if (input.indexTrigger >= IndexThreshold && input.previousIndexTrigger < IndexThreshold) { input.indexPressFrame = context.GetRenderFrame(); } input.pointing = true; input.x = controllerPose.button1IsDown; input.y = controllerPose.button2IsDown; input.stick = controllerPose.joystickPosition; }
public void UnregisterSecondaryButtonTriggeredNotifies(HandInput handInput, Action notify) { secondaryButtonTriggeredNotifies[(int)handInput].Remove(notify); }
public void UnregisterDevicePositionNotify(HandInput handInput, Action <Vector3> notify) { devicePositionNotifies[(int)handInput].Remove(notify); }
public void RegisterGripStrengthNotify(HandInput handInput, Action <float> notify) { gripStrengthNotifies[(int)handInput].Add(notify); }