/// <summary>
        /// Creates a new HandGrabInteractable from the stored data.
        /// Mostly used to restore a HandGrabInteractable that was stored during Play-Mode.
        /// </summary>
        /// <param name="data">The data of the HandGrabInteractable.</param>
        /// <returns>The generated HandGrabInteractable.</returns>
        private HandGrabInteractable LoadHandGrabInteractable(HandGrabInteractableData data)
        {
            HandGrabInteractable interactable = HandGrabInteractable.Create(_recordable.transform);

            interactable.LoadData(data);
            return(interactable);
        }
        /// <summary>
        /// Creates a new HandGrabInteractable at the exact pose of a given hand.
        /// Mostly used with Hand-Tracking at Play-Mode
        /// </summary>
        /// <param name="rawPose">The user controlled hand pose.</param>
        /// <param name="snapPoint">The user controlled hand pose.</param>
        /// <returns>The generated HandGrabPoint.</returns>
        public HandGrabPoint AddHandGrabPoint(HandPose rawPose, Pose snapPoint)
        {
            HandGrabInteractable interactable = HandGrabInteractable.Create(_recordable.transform);
            HandGrabPointData    pointData    = new HandGrabPointData()
            {
                handPose = rawPose,
                scale    = 1f,
                gripPose = snapPoint,
            };

            return(interactable.LoadPoint(pointData));
        }
Exemple #3
0
        private void DrawGenerationMenu()
        {
            if (GUILayout.Button("Create Mirrored HandGrabInteractable"))
            {
                HandGrabInteractable mirrorInteractable =
                    HandGrabInteractable.Create(_interactable.RelativeTo,
                                                $"{_interactable.gameObject.name}_mirror");

                HandGrabInteractableData data = _interactable.SaveData();
                data.points = null;
                mirrorInteractable.LoadData(data);

                foreach (HandGrabPoint point in _interactable.GrabPoints)
                {
                    HandGrabPoint mirrorPoint = mirrorInteractable.CreatePoint();
                    HandGrabPointEditor.MirrorHandGrabPoint(point, mirrorPoint);
                    mirrorPoint.transform.SetParent(mirrorInteractable.transform);
                    mirrorInteractable.GrabPoints.Add(mirrorPoint);
                }
            }
        }
Exemple #4
0
 private void Awake()
 {
     _interactable = target as HandGrabInteractable;
 }