コード例 #1
0
        /// <summary>
        /// Fire a beam from the head's current position in the gaze's direction. If it hits anything, give the hit point
        /// and the normal at that point
        /// </summary>
        public TargetingResult AcquireTarget()
        {
            RaycastResult result = _raycaster.CastRay(_headPosition, _viewDirection);

            return(result.WasHit ?
                   new TargetingResult(result.HitObject, result.HitPosition, result.HitNormal) :
                   new TargetingResult(null));
        }
コード例 #2
0
        public void Tick()
        {
            RaycastResult result = _raycaster.CastRay(_headPosition, _viewDirection);

            // If we hit something, place the focus point at the hit.
            // If not, place it the default distance straight in front of the user's head
            Vector3 fPoint = result.WasHit ? result.HitPosition : _headPosition + _defaultDistance * _viewDirection;
            // Always have the normal pointing the opposite direction of the view vector
            Vector3 normal = -_viewDirection;

            HolographicSettings.SetFocusPointForFrame(fPoint, normal);
        }