protected override void AddTrackableData(SynthesizedBody synthesizedTrackable, MARSTrackingState trackingState)
        {
            var body   = synthesizedTrackable.GetData();
            var dataId = this.AddOrUpdateData(body);

            this.AddOrUpdateTrait(dataId, TraitNames.Body, true);
            this.AddOrUpdateTrait(dataId, TraitNames.Pose, body.pose);

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

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

            BodyAdded?.Invoke(body);
        }
Example #2
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;
            }
        }
Example #3
0
 private void BodyAddedRaise(MaterialPoint body)
 {
     BodyAdded?.Invoke(body);
 }