public static void MakeMeshCrude(this CSGVector3 vector, GameObject go)
 {
     foreach (var block in vector)
     {
         GameObject container = new GameObject("Block");
         container.transform.parent     = go.transform;
         container.transform.position   = go.transform.position;
         container.transform.rotation   = go.transform.rotation;
         container.transform.localScale = go.transform.localScale;
         block.MakeMeshCrude(container);
     }
 }
 public static void MakeMesh(this CSGVector3 vector, GameObject go, Action <GameObject> goAction = null)
 {
     foreach (var block in vector)
     {
         GameObject container = new GameObject("Block");
         container.transform.parent     = go.transform;
         container.transform.position   = go.transform.position;
         container.transform.rotation   = go.transform.rotation;
         container.transform.localScale = go.transform.localScale;
         block.MakeMesh(container);
         if (goAction != null)
         {
             goAction(container);
         }
     }
 }
Exemplo n.º 3
0
        public static CSGVector3 operator +(CSGVector3 a, CSGVector3 b)
        {
            //This operation works via set subtraction
            //aOnly = a - b
            //bOnly = b - a
            //intersec = a - aOnly
            List <CSGBlock> intersec = new List <CSGBlock>();
            var             aOnly    = CSGGeometry.VectorSetSubtract(a.blocks, b.blocks, intersec);
            var             bOnly    = CSGGeometry.VectorSetSubtract(b.blocks, a.blocks);

            //aOnly and bOnly are merged with intersec to create a new vector
            intersec.AddRange(aOnly);
            intersec.AddRange(bOnly);
            CSGVector3 output = new CSGVector3(intersec);

            //Remove zeroes is processeced, if required
            if (AutoRemoveZeros)
            {
                output.RemoveZeros();
            }

            //the vector is returned
            return(output);
        }