PayloadScan scanPayload()
        {
            // scan payload and build its profile
            var scan = new PayloadScan(part, verticalStep, extraRadius);

            AttachNode node = part.findAttachNode("top");

            if (node != null)
            {
                scan.ofs = node.position.y;
                if (node.attachedPart != null)
                {
                    scan.addPart(node.attachedPart, part);
                }
            }

            node = part.findAttachNode("top1");
            if (node != null)
            {
//      scan.ofs=node.position.y;
                if (node.attachedPart != null)
                {
                    scan.addPart(node.attachedPart, part);
                }
            }

            for (int i = 0; i < scan.payload.Count; ++i)
            {
                var cp = scan.payload[i];

                // add connected payload parts
                scan.addPart(cp.parent, cp);
                foreach (var p in cp.children)
                {
                    scan.addPart(p, cp);
                }

                // scan part colliders
                foreach (var coll in cp.FindModelComponents <Collider>())
                {
                    if (coll.tag != "Untagged")
                    {
                        continue;           // skip ladders etc.
                    }
                    scan.addPayload(coll);
                }
            }

            return(scan);
        }
Example #2
0
        PayloadScan scanPayload()
        {
            //  Scan the payload and build it's profile.

            var scan = new PayloadScan(part, verticalStep, extraRadius);

            AttachNode node = part.FindAttachNode("top");

            if (node != null)
            {
                scan.ofs = node.position.y;

                if (node.attachedPart != null)
                {
                    scan.addPart(node.attachedPart, part);
                }
            }

            AttachNode [] nodes = part.FindAttachNodes("interstage");

            if (nodes != null)
            {
                for (int j = 0; j < nodes.Length; j++)
                {
                    node = nodes [j];

                    if (node != null)
                    {
                        if (node.attachedPart != null)
                        {
                            scan.addPart(node.attachedPart, part);
                        }
                    }
                }
            }

            for (int i = 0; i < scan.payload.Count; ++i)
            {
                var cp = scan.payload [i];

                //  Add any connected payload parts.

                scan.addPart(cp.parent, cp);

                for (int j = 0; j < cp.children.Count; j++)
                {
                    scan.addPart(cp.children[j], cp);
                }

                //  Scan for the part colliders.

                var colls = cp.FindModelComponents <Collider>();

                for (int j = 0; j < colls.Count; j++)
                {
                    var coll = colls [j];

                    //  Skip ladders etc...

                    if (coll.tag != "Untagged")
                    {
                        continue;
                    }

                    scan.addPayload(coll);
                }
            }

            return(scan);
        }
        PayloadScan scanPayload()
        {
            // scan payload and build its profile
            var scan=new PayloadScan(part, verticalStep, extraRadius);

            AttachNode node=part.findAttachNode("top");
            if (node!=null)
            {
              scan.ofs=node.position.y;
              if (node.attachedPart!=null) scan.addPart(node.attachedPart, part);
            }

            node=part.findAttachNode("top1");
            if (node!=null)
            {
            //      scan.ofs=node.position.y;
              if (node.attachedPart!=null) scan.addPart(node.attachedPart, part);
            }

            for (int i=0; i<scan.payload.Count; ++i)
            {
              var cp=scan.payload[i];

              // add connected payload parts
              scan.addPart(cp.parent, cp);
              foreach (var p in cp.children) scan.addPart(p, cp);

              // scan part colliders
              foreach (var coll in cp.FindModelComponents<Collider>())
              {
            if (coll.tag!="Untagged") continue; // skip ladders etc.
            scan.addPayload(coll);
              }
            }

            return scan;
        }