Exemplo n.º 1
0
 public ObjectSnappingAddress(Snappable snappable, BaseSnapPoint point, ScoredHandPose pose)
 {
     this.snappable    = snappable;
     this.point        = point;
     this.pose         = pose;
     this.originalPose = snappable.transform.GetPose();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Calculate the best pre-recorded snap-point to grab an object.
        /// </summary>
        /// <param name="grabbable">The snappable object.</param>
        /// <returns>
        /// If the snappable is object is valid, the best SnapPoint to grab it alongside the
        /// Hand-Pose to use when grabbing at that position.
        /// </returns>
        private (BaseSnapPoint, ScoredHandPose)? SnapForGrabbable(GameObject grabbable)
        {
            if (grabbable == null)
            {
                return(null);
            }
            Snappable snappable = grabbable.GetComponent <Snappable>();

            if (snappable != null)
            {
                HandPose      userPose = this.puppet.TrackedPose(snappable.transform);
                BaseSnapPoint snapPose = snappable.FindBestSnapPose(userPose, out ScoredHandPose bestPose);
                if (snapPose != null)
                {
                    return(snapPose, bestPose);
                }
            }
            return(null);
        }