Exemple #1
0
 /// <summary>
 /// Constructor taking all dependencies.
 /// </summary>
 /// <param name="prefab">The prefab to create visuals out of.</param>
 /// <param name="fragmentVisuals">Fragments to attach the visuals to.</param>
 /// <param name="frozenFromLocked">Transform for setting the created visual's pose.</param>
 public FrozenAnchorVisualCreator(
     FrozenAnchorVisual prefab,
     Dictionary <FragmentId, FrameVisual> fragmentVisuals,
     Pose frozenFromLocked)
 {
     Prefab_FrozenAnchorViz = prefab;
     frozenFragmentVisuals  = fragmentVisuals;
     this.frozenFromLocked  = frozenFromLocked;
 }
Exemple #2
0
            /// <summary>
            /// Set or update the pose of the resource.
            /// </summary>
            /// <param name="source">Source FrozenAnchor associated with the resource.</param>
            /// <param name="target">The resource to set the pose of.</param>
            private void SetPose(AnchorFragmentPose source, FrozenAnchorVisual target)
            {
                Pose localPose = source.fragmentPose.pose;

                localPose = frozenFromLocked.Multiply(localPose);
                // The following line introduces an artificial displacement between corresponding frozen and
                // spongy anchors, to make sure the connecting line visualization is working.
                //localPose.position.y += 0.25f;
                target.transform.SetLocalPose(localPose);
            }
Exemple #3
0
            /// <summary>
            /// Create a visible line connecting the frozen anchor to the spongy anchor.
            /// </summary>
            /// <param name="id">The anchor id of the frozen and spongy anchors.</param>
            /// <param name="frozen">The frozen anchor.</param>
            /// <param name="spongy">The spongy anchor.</param>
            /// <returns></returns>
            public IdPair <AnchorId, ConnectingLine> CreateDisplacement(AnchorId id, FrozenAnchorVisual frozen, SpongyAnchorVisual spongy)
            {
                var newLine = ConnectingLine.Create(spongy.transform.parent,
                                                    frozen.transform,
                                                    spongy.transform,
                                                    0.01f, Color.red);

                return(new IdPair <AnchorId, ConnectingLine>()
                {
                    id = id,
                    target = newLine
                });
            }