Exemplo n.º 1
0
 internal void UpdateLinkPositions(ref Vector3[] boundsCorners)
 {
     if (boundsCorners != null)
     {
         for (int i = 0; i < links.Count; ++i)
         {
             links[i].transform.position = VisualUtils.GetLinkPosition(i, ref boundsCorners);
         }
     }
 }
Exemplo n.º 2
0
 /// <inheritdoc/>
 internal override void CalculateHandlePositions(ref Vector3[] boundsCorners)
 {
     if (boundsCorners != null && HandlePositions != null)
     {
         for (int i = 0; i < HandlePositions.Length; ++i)
         {
             HandlePositions[i] = VisualUtils.GetLinkPosition(i, ref boundsCorners);
         }
         UpdateHandles();
     }
 }
Exemplo n.º 3
0
        internal void CalculateEdgeCenters(ref Vector3[] boundsCorners)
        {
            if (boundsCorners != null && edgeCenters != null)
            {
                for (int i = 0; i < edgeCenters.Length; ++i)
                {
                    edgeCenters[i] = VisualUtils.GetLinkPosition(i, ref boundsCorners);
                }
            }

            UpdateHandles();
        }
Exemplo n.º 4
0
        internal void CreateLinks(ref Vector3[] boundsCorners, Transform parent, Vector3 currentBoundsExtents)
        {
            // create links
            if (links != null)
            {
                GameObject link;
                Vector3    linkDimensions = GetLinkDimensions(currentBoundsExtents);
                for (int i = 0; i < VisualUtils.EdgeAxisType.Length; ++i)
                {
                    if (config.WireframeShape == WireframeType.Cubic)
                    {
                        link = GameObject.CreatePrimitive(PrimitiveType.Cube);
                        Object.Destroy(link.GetComponent <BoxCollider>());
                    }
                    else
                    {
                        link = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
                        Object.Destroy(link.GetComponent <CapsuleCollider>());
                    }
                    link.name = "link_" + i.ToString();

                    CardinalAxisType axisType            = VisualUtils.EdgeAxisType[i];
                    float            wireframeEdgeRadius = config.WireframeEdgeRadius;
                    if (axisType == CardinalAxisType.Y)
                    {
                        link.transform.localScale = new Vector3(wireframeEdgeRadius, linkDimensions.y, wireframeEdgeRadius);
                        link.transform.Rotate(new Vector3(0.0f, 90.0f, 0.0f));
                    }
                    else if (axisType == CardinalAxisType.Z)
                    {
                        link.transform.localScale = new Vector3(wireframeEdgeRadius, linkDimensions.z, wireframeEdgeRadius);
                        link.transform.Rotate(new Vector3(90.0f, 0.0f, 0.0f));
                    }
                    else//X
                    {
                        link.transform.localScale = new Vector3(wireframeEdgeRadius, linkDimensions.x, wireframeEdgeRadius);
                        link.transform.Rotate(new Vector3(0.0f, 0.0f, 90.0f));
                    }

                    link.transform.position = VisualUtils.GetLinkPosition(i, ref boundsCorners);
                    link.transform.parent   = parent;
                    Renderer linkRenderer = link.GetComponent <Renderer>();

                    if (config.WireframeMaterial != null)
                    {
                        linkRenderer.material = config.WireframeMaterial;
                    }

                    link.SetActive(config.ShowWireFrame);
                    links.Add(new Link(link.transform, axisType));
                }
            }
        }