Exemplo n.º 1
0
        protected override void UpdateObjectTrackables(SimulatedObject simulatedObject)
        {
            m_SimulatedTrackables[simulatedObject].Clear();

            foreach (var synthBody in simulatedObject.GetComponentsInChildren <SynthesizedBody>())
            {
                var body   = synthBody.GetData();
                var dataId = this.AddOrUpdateData(body);
                this.AddOrUpdateTrait(dataId, TraitNames.Pose, body.pose);
                BodyUpdated?.Invoke(body);
                m_SimulatedTrackables[simulatedObject].Add(body);
            }
        }
Exemplo n.º 2
0
        protected override void UpdateObjectTrackables(SimulatedObject simulatedObject)
        {
            m_SimulatedTrackables[simulatedObject].Clear();

            foreach (var synthPlane in simulatedObject.GetComponentsInChildren <SynthesizedPlane>())
            {
                var plane  = synthPlane.GetData();
                var dataId = this.AddOrUpdateData(plane);
                this.AddOrUpdateTrait(dataId, TraitNames.Pose, plane.pose);
                this.AddOrUpdateTrait(dataId, TraitNames.Bounds2D, plane.extents);
                planeUpdated?.Invoke(plane);
                m_SimulatedTrackables[simulatedObject].Add(plane);
            }
        }
        protected override void UpdateObjectTrackables(SimulatedObject simulatedObject)
        {
            m_SimulatedTrackables[simulatedObject].Clear();

            foreach (var synthesizedMarker in simulatedObject.GetComponentsInChildren <SynthesizedMarker>())
            {
                var marker = synthesizedMarker.GetData();
                var dataId = this.AddOrUpdateData(marker);
                this.AddOrUpdateTrait(dataId, TraitNames.Pose, marker.pose);
                this.AddOrUpdateTrait(dataId, TraitNames.Bounds2D, marker.extents);
                this.AddOrUpdateTrait(dataId, TraitNames.TrackingState, (int)marker.trackingState);
                markerUpdated?.Invoke(marker);
                m_SimulatedTrackables[simulatedObject].Add(marker);
            }
        }
        protected override void AddObjectTrackables(SimulatedObject simulatedObject)
        {
            var objectMarkers = new List <MRMarker>();

            foreach (var synthesizedMarker in simulatedObject.GetComponentsInChildren <SynthesizedMarker>())
            {
                if (!synthesizedMarker.isActiveAndEnabled)
                {
                    continue;
                }

                synthesizedMarker.Initialize();
                var marker = synthesizedMarker.GetData();

                if (marker.id == MarsTrackableId.InvalidId)
                {
                    continue;
                }

                objectMarkers.Add(marker);
                var dataId = this.AddOrUpdateData(marker);
                synthesizedMarker.dataID = dataId;
                this.AddOrUpdateTrait(dataId, TraitNames.Marker, true);
                this.AddOrUpdateTrait(dataId, TraitNames.MarkerId, marker.markerId.ToString());
                this.AddOrUpdateTrait(dataId, TraitNames.Pose, marker.pose);
                this.AddOrUpdateTrait(dataId, TraitNames.Bounds2D, marker.extents);
                this.AddOrUpdateTrait(dataId, TraitNames.TrackingState, (int)marker.trackingState);

                foreach (var synthTag in synthesizedMarker.GetComponents <SynthesizedSemanticTag>())
                {
                    if (!synthTag.isActiveAndEnabled)
                    {
                        continue;
                    }

                    this.AddOrUpdateTrait(dataId, synthTag.TraitName, synthTag.GetTraitData());
                }

                markerAdded?.Invoke(marker);
            }

            if (objectMarkers.Count > 0)
            {
                m_SimulatedTrackables[simulatedObject] = objectMarkers;
            }
        }
Exemplo n.º 5
0
        protected override void AddObjectTrackables(SimulatedObject simulatedObject)
        {
            var objectPlanes = new List <MRPlane>();

            foreach (var synthPlane in simulatedObject.GetComponentsInChildren <SynthesizedPlane>())
            {
                if (!synthPlane.isActiveAndEnabled)
                {
                    continue;
                }

                synthPlane.Initialize();
                var plane = synthPlane.GetData();

                if (plane.id == MarsTrackableId.InvalidId)
                {
                    continue;
                }

                objectPlanes.Add(plane);
                var dataId = this.AddOrUpdateData(plane);
                synthPlane.dataID = dataId;
                this.AddOrUpdateTrait(dataId, TraitNames.Plane, true);
                this.AddOrUpdateTrait(dataId, TraitNames.Alignment, (int)plane.alignment);
                this.AddOrUpdateTrait(dataId, TraitNames.Pose, plane.pose);
                this.AddOrUpdateTrait(dataId, TraitNames.Bounds2D, plane.extents);

                foreach (var synthTag in synthPlane.GetComponents <SynthesizedSemanticTag>())
                {
                    if (!synthTag.isActiveAndEnabled)
                    {
                        continue;
                    }

                    this.AddOrUpdateTrait(dataId, synthTag.TraitName, synthTag.GetTraitData());
                }

                planeAdded?.Invoke(plane);
            }

            if (objectPlanes.Count > 0)
            {
                m_SimulatedTrackables[simulatedObject] = objectPlanes;
            }
        }
Exemplo n.º 6
0
        protected override void AddObjectTrackables(SimulatedObject simulatedObject)
        {
            var simObjectBodies = new List <IMarsBody>();

            foreach (var synthBody in simulatedObject.GetComponentsInChildren <SynthesizedBody>())
            {
                if (!synthBody.isActiveAndEnabled)
                {
                    continue;
                }

                synthBody.Initialize();
                var body = synthBody.GetData();
                if (body.id == MarsTrackableId.InvalidId)
                {
                    continue;
                }

                simObjectBodies.Add(body);
                var dataId = this.AddOrUpdateData(body);
                this.AddOrUpdateTrait(dataId, TraitNames.Body, true);
                this.AddOrUpdateTrait(dataId, TraitNames.Pose, body.pose);

                foreach (var synthTag in synthBody.GetComponents <SynthesizedSemanticTag>())
                {
                    if (!synthTag.isActiveAndEnabled)
                    {
                        continue;
                    }

                    this.AddOrUpdateTrait(dataId, synthTag.TraitName, synthTag.GetTraitData());
                }

                BodyAdded?.Invoke(body);
            }

            if (simObjectBodies.Count > 0)
            {
                m_SimulatedTrackables[simulatedObject] = simObjectBodies;
            }
        }