Example #1
0
        // TODO: Is it possible to remove the redudant raycasts?
        public G2OM_RaycastResult GetRaycastResult(ref G2OM_DeviceData deviceData,
                                                   IG2OM_ObjectDistinguisher distinguisher)
        {
            var raycastResult = new G2OM_RaycastResult();

            GameObject go;
            var        result = FindGameObject(ref deviceData.combined, _layerMask, out go);

            if (result)
            {
                var id            = go.GetInstanceID();
                var hitACandidate = distinguisher.IsGameObjectGazeFocusable(id, go);
                raycastResult.combined = new G2OM_Raycast(hitACandidate, id);
            }

            result = FindGameObject(ref deviceData.leftEye, _layerMask, out go);
            if (result)
            {
                var id            = go.GetInstanceID();
                var hitACandidate = distinguisher.IsGameObjectGazeFocusable(id, go);
                raycastResult.left = new G2OM_Raycast(hitACandidate, id);
            }

            result = FindGameObject(ref deviceData.rightEye, _layerMask, out go);
            if (result)
            {
                var id            = go.GetInstanceID();
                var hitACandidate = distinguisher.IsGameObjectGazeFocusable(id, go);
                raycastResult.right = new G2OM_Raycast(hitACandidate, id);
            }

            return(raycastResult);
        }
        public bool Process(ref G2OM_DeviceData deviceData, ref G2OM_RaycastResult raycastResult, int candidateCount, G2OM_Candidate[] candidates, G2OM_CandidateResult[] candidateResults)
        {
            var result = Interop.G2OM_Process(_context, ref deviceData, ref raycastResult, (uint)candidateCount, candidates, candidateResults);

            if (result == G2OM_Error.Ok)
            {
                return(true);
            }

            Debug.LogError("Failed to process G2OM. Error code " + result);
            return(false);
        }
Example #3
0
        // TODO: Is it possible to remove the redudant raycasts?
        public G2OM_RaycastResult GetRaycastResult(
            ref G2OM_DeviceData deviceData,
            IG2OM_ObjectDistinguisher distinguisher)
        {
            var raycastResult = new G2OM_RaycastResult();

            GameObject go;
            var        result = FindGameObject(ref deviceData.gaze_ray_world_space.ray, _layerMask, out go);

            if (result)
            {
                var id            = go.GetInstanceID();
                var hitACandidate = distinguisher.IsGameObjectGazeFocusable(id, go);
                raycastResult.gaze_ray = new G2OM_Raycast
                {
                    candidate_id        = (ulong)id,
                    is_raycast_id_valid = hitACandidate.ToByte()
                };
            }

            return(raycastResult);
        }
 public static extern G2OM_Error G2OM_Process(IntPtr context, ref G2OM_DeviceData deviceData, ref G2OM_RaycastResult raycastResult, uint candidatesCount, G2OM_Candidate[] candidates, G2OM_CandidateResult[] candidateResults);