Пример #1
0
        private static void UpdateListOfFocusedCandidates(G2OM_CandidateResult[] candidateResult, Dictionary <int, InternalCandidate> allCandidates, List <FocusedCandidate> gazeFocusedObjects)
        {
            gazeFocusedObjects.Clear();

            for (int i = 0; i < allCandidates.Count; i++)
            {
                var candidate = candidateResult[i];

                if (candidate.score <= Mathf.Epsilon)
                {
                    break;
                }

                var id = (int)candidate.candidate_id;

                if (allCandidates.ContainsKey(id) == false)
                {
                    Debug.LogError("This should not happen"); // TODO: What should we do if this happens? -- swik 2019-09-04
                    continue;
                }

                var gazeFocusedObject = new FocusedCandidate
                {
                    GameObject = allCandidates[id].GameObject,
                    IsRayValid = candidate.adjusted_gaze_ray_world_space.is_valid.ToBool(),
                    Direction  = candidate.adjusted_gaze_ray_world_space.ray.direction.Vector(),
                    Origin     = candidate.adjusted_gaze_ray_world_space.ray.origin.Vector(),
                };

                gazeFocusedObjects.Add(gazeFocusedObject);
            }
        }
Пример #2
0
        private static void UpdateListOfFocusedCandidates(G2OM_CandidateResult[] result, Dictionary <int, InternalCandidate> allCandidates, List <FocusedCandidate> focusedObjects, IG2OM_ObjectFinder objectFinder)
        {
            focusedObjects.Clear();

            for (int i = 0; i < allCandidates.Count; i++)
            {
                var candidate = result[i];

                if (candidate.score <= Mathf.Epsilon)
                {
                    break;
                }

                var gazeFocusedObject = new FocusedCandidate
                {
                    GameObject = allCandidates[candidate.Id].GameObject,
                    IsRayValid = candidate.adjustedCombinedRay.IsValid,
                    Direction  = candidate.adjustedCombinedRay.ray.direction.Vector,
                    Origin     = candidate.adjustedCombinedRay.ray.origin.Vector,
                };

                focusedObjects.Add(gazeFocusedObject);
            }
        }