示例#1
0
        Node CreatePointer(Node parent, float width, bool arrowDown, TrailDecoration decoration, Vector3 start, Vector3 end)
        {
            var length      = Vector3.Distance(start, end);
            var minLength   = width * 6;
            var arrowWidth  = width * 2;
            var arrowHeight = width * 4;
            var lineHeight  = length - arrowHeight;

            if (length < minLength)
            {
                lineHeight = minLength - arrowHeight;
            }
            var plateheight = .05f;
            var plateWidth  = 2.2f;
            var pointer     = parent.CreateChild();
            var line        = CreateShape <Cylinder>(pointer, decoration, new Vector3(0, arrowDown ? arrowHeight + (lineHeight / 2f) : lineHeight / 2f, 0), new Vector3(width, lineHeight, width));
            var arrow       = CreateShape <Cone>(pointer, decoration, new Vector3(0, arrowDown ? arrowHeight / 2f : lineHeight + (arrowHeight / 2f), 0), new Vector3(arrowWidth, arrowHeight, arrowWidth));

            if (arrowDown)
            {
                arrow.Roll(180);
            }
            var plate = CreateShape <Cylinder>(parent, decoration, new Vector3(0, -plateheight / 2f, 0), new Vector3(plateWidth, plateheight, plateWidth));

            parent.SetWorldPosition(end);
            pointer.LookAt(start, Vector3.Up, TransformSpace.World);
            pointer.Pitch(90);
            return(pointer);
        }
示例#2
0
        Node CreateShape <T>(Node parent, TrailDecoration decoration, Vector3 position, Vector3 scale)
            where T : Shape
        {
            var node  = parent.CreateChild();
            var shape = node.CreateComponent <T>();

            node.Scale    = scale;
            node.Position = position;
            shape.Color   = new Color(decoration.R / 255f, decoration.G / 255f, decoration.B / 255f, decoration.A / 255f);
            shape.Material.SetTechnique(0, CoreAssets.Techniques.NoTextureUnlitAlpha); //self illuminating
            shape.ViewMask = 1;                                                        //invisible to Selection Manager
            return(node);
        }