Exemplo n.º 1
0
        public void update(float bottomStart, float height, float botWidth, float topWidth, float thickness)
        {
            float    maxWidth  = (topWidth > botWidth)? topWidth : botWidth;
            float    widthDiff = (topWidth > botWidth) ? topWidth - botWidth : botWidth - topWidth;
            Cylinder c0        = multiCylinder.cylinders[0];
            Cylinder c1        = multiCylinder.cylinders[1];
            Cylinder c2        = multiCylinder.cylinders[2];

            //Sets outer shell values
            c0.bottomStart = bottomStart;
            c0.height      = height;
            c0.botWidth    = botWidth;
            c0.topWidth    = topWidth;
            c0.tiling      = 2;
            c0.uvBot       = 0;
            c0.uvTop       = (height) / (6 * maxWidth / c0.tiling);
            if (c0.uvTop > 240 / 512f)
            {
            }
            c0.uvTop = 240 / 512f;

            //Sets top bit values
            c1.bottomStart = bottomStart + height;
            c1.height      = 0;
            c1.botWidth    = topWidth;
            c1.topWidth    = topWidth - thickness * topWidth;
            c1.uvBot       = (241 / 512f);
            c1.uvTop       = ((512 - 241) / 512f);
            c1.tiling      = ((int)(6 * (30 / 512f) / (thickness * topWidth) * (6 * topWidth))) / 6f;

            //Sets inner shell values
            c2.bottomStart = bottomStart + height;
            c2.height      = -height;
            c2.botWidth    = topWidth - thickness * topWidth;
            c2.topWidth    = botWidth - thickness * topWidth;
            c2.uvBot       = ((512 - 240) / 512f);
            c2.uvTop       = 1;

            //Updates mesh
            multiCylinder.UpdateCylinders();
        }
Exemplo n.º 2
0
        public void update()
        {
            getDecouplerShroudValues();

            topWidth += antiZFightSizeIncrease;
            botWidth += antiZFightSizeIncrease;

            float    maxWidth  = (topWidth > botWidth)? topWidth : botWidth;
            float    widthDiff = (topWidth > botWidth) ? topWidth - botWidth : botWidth - topWidth;
            Cylinder c0        = multiCylinder.cylinders[0];      //outside shell
            Cylinder c1        = multiCylinder.cylinders[1];      //top flat bit
            Cylinder c2        = multiCylinder.cylinders[2];      //inside
            Cylinder c3        = multiCylinder.cylinders[3];      //bottom tucked in edge
            Cylinder c4        = multiCylinder.cylinders[4];      //top bevel in edge

            Vector2 bevel = new Vector2((botWidth - topWidth), height).normalized + Vector2.right;

            bevel = bevel.normalized * topBevelSize;

            //Creates bottom edge
            c3.bottomStart = vertOffset - bottomEdgeSize;
            c3.height      = bottomEdgeSize;
            c3.botWidth    = botWidth - bottomEdgeSize;
            c3.topWidth    = botWidth;
            c3.tiling      = 2;
            c3.uvBot       = 0;
            c3.uvTop       = .01f;

            //Sets outer shell values
            c0.bottomStart = vertOffset;
            c0.height      = height - bevel.y;
            c0.botWidth    = botWidth;
            c0.topWidth    = topWidth;
            c0.tiling      = 2;
            c0.uvBot       = 0.01f;
            c0.uvTop       = 240 / 512f - .01f;
            //c0.uvTop = (height) / (6*maxWidth / c0.tiling);
            //if (c0.uvTop > 240 / 512f) {
            //}

            //Set top Bevel
            c4.bottomStart = vertOffset + height - bevel.y;
            c4.height      = bevel.y;
            c4.botWidth    = topWidth;
            c4.topWidth    = topWidth - bevel.x;
            c4.tiling      = 2;
            c4.uvBot       = 240 / 512f - .01f;
            c4.uvTop       = 240 / 512f;

            //Sets top bit values
            c1.bottomStart = vertOffset + height;
            c1.height      = 0;
            c1.botWidth    = topWidth - bevel.x;
            c1.topWidth    = (topWidth - bevel.x) - thickness * topWidth;
            c1.uvBot       = (241 / 512f);
            c1.uvTop       = ((512 - 241) / 512f);
            c1.tiling      = ((int)(6 * (30 / 512f) / (thickness * topWidth) * (6 * topWidth))) / 6f;

            //Sets inner shell values
            c2.bottomStart = vertOffset + height;
            c2.height      = -height;
            c2.botWidth    = topWidth - thickness * topWidth;
            c2.topWidth    = botWidth - thickness * topWidth;
            c2.uvBot       = ((512 - 240) / 512f);
            c2.uvTop       = 1;


            topWidth -= antiZFightSizeIncrease;
            botWidth -= antiZFightSizeIncrease;

            //Updates mesh
            multiCylinder.UpdateCylinders();
        }
        public void setCylinderValues()
        {
            getDecouplerShroudValues();

            topWidth += antiZFightSizeIncrease;
            botWidth += antiZFightSizeIncrease;

            float    maxWidth  = (topWidth > botWidth) ? topWidth : botWidth;
            float    widthDiff = (topWidth > botWidth) ? topWidth - botWidth : botWidth - topWidth;
            Cylinder cout      = multiCylinder.cylinders[0];       //outside shell
            Cylinder ctopBevel = multiCylinder.cylinders[5];       //top bevel in edge
            Cylinder ctop      = multiCylinder.cylinders[4];       //top flat bit
            Cylinder inside    = multiCylinder.cylinders[3];       //inside
            Cylinder cbot      = multiCylinder.cylinders[2];       //bottom flat
            Cylinder cBotBevel = multiCylinder.cylinders[1];       //bottom tucked in edge

            Cylinder coll0 = collCylinder.cylinders[0];            //Collision outer
            Cylinder coll1 = collCylinder.cylinders[1];            //Collision inner

            Vector2 bevel = new Vector2((botWidth - topWidth), height).normalized + Vector2.right;

            bevel = bevel.normalized * topBevelSize;

            //Creates bottom edge
            cBotBevel.submesh     = 0;
            cBotBevel.bottomStart = vertOffset - bottomEdgeSize;
            cBotBevel.height      = bottomEdgeSize;
            cBotBevel.botWidth    = botWidth - bottomEdgeSize;
            cBotBevel.topWidth    = botWidth;
            cBotBevel.uvBot       = 0;
            cBotBevel.uvTop       = .01f;

            //Sets outer shell values
            cout.submesh     = 0;
            cout.bottomStart = vertOffset;
            cout.height      = height - bevel.y;
            cout.botWidth    = botWidth;
            cout.topWidth    = topWidth;
            cout.uvBot       = 0.01f;
            cout.uvTop       = 1 - .01f;
            cout.rings       = outerEdgeLoops;
            //c0.uvTop = (height) / (6*maxWidth / c0.tiling);
            //if (c0.uvTop > 240 / 512f) {
            //}

            //Set top Bevel
            ctopBevel.submesh     = 0;
            ctopBevel.bottomStart = vertOffset + height - bevel.y;
            ctopBevel.height      = bevel.y;
            ctopBevel.botWidth    = topWidth;
            ctopBevel.topWidth    = topWidth - bevel.x;
            ctopBevel.uvBot       = 1 - .01f;
            ctopBevel.uvTop       = 1;

            //Sets top bit values
            ctop.submesh     = 1;
            ctop.bottomStart = vertOffset + height;
            ctop.height      = 0;
            ctop.botWidth    = topWidth - bevel.x;
            ctop.topWidth    = (topWidth - bevel.x) - thickness * topWidth;
            ctop.uvBot       = 0;
            ctop.uvTop       = 1;
            ctop.rings       = topEdgeLoops;

            //Sets bottom flat bit
            cbot.submesh     = 1;
            cbot.bottomStart = vertOffset - bottomEdgeSize;
            cbot.height      = 0;
            cbot.topWidth    = botWidth - bottomEdgeSize;
            cbot.botWidth    = Mathf.Min(botWidth - thickness * topWidth, botWidth - bottomEdgeSize);
            cbot.uvBot       = 0;
            cbot.uvTop       = 1;
            cbot.rings       = topEdgeLoops;

            //Sets inner shell values
            inside.submesh     = 2;
            inside.bottomStart = vertOffset + height;
            inside.height      = -height - bottomEdgeSize;
            inside.botWidth    = topWidth - thickness * topWidth;
            inside.topWidth    = Mathf.Min(botWidth - thickness * topWidth, botWidth - bottomEdgeSize);
            inside.uvBot       = 0;
            inside.uvTop       = 1;

            coll0.submesh     = 0;
            coll0.bottomStart = vertOffset;
            coll0.height      = height - bevel.y;
            coll0.botWidth    = botWidth;
            coll0.topWidth    = topWidth;
            coll1.uvBot       = 0;
            coll1.uvTop       = 1;

            coll1.submesh     = 0;
            coll1.bottomStart = vertOffset + height;
            coll1.height      = -height - bottomEdgeSize;
            coll1.botWidth    = topWidth - thickness * topWidth / 4f;
            coll1.topWidth    = Mathf.Min(botWidth - thickness * topWidth / 4f, botWidth - bottomEdgeSize);
            coll1.uvBot       = 0;
            coll1.uvTop       = 1;

            topWidth -= antiZFightSizeIncrease;
            botWidth -= antiZFightSizeIncrease;
        }
Exemplo n.º 4
0
        public void setCylinderValues()
        {
            getDecouplerShroudValues();

            topWidth += antiZFightSizeIncrease;
            botWidth += antiZFightSizeIncrease;

            float    maxWidth  = (topWidth > botWidth) ? topWidth : botWidth;
            float    widthDiff = (topWidth > botWidth) ? topWidth - botWidth : botWidth - topWidth;
            Cylinder c0        = multiCylinder.cylinders[0];      //outside shell
            Cylinder c1        = multiCylinder.cylinders[1];      //top flat bit
            Cylinder c2        = multiCylinder.cylinders[2];      //inside
            Cylinder c3        = multiCylinder.cylinders[3];      //bottom tucked in edge
            Cylinder c4        = multiCylinder.cylinders[4];      //top bevel in edge
            Cylinder c5        = multiCylinder.cylinders[5];      //bottom flat


            Vector2 bevel = new Vector2((botWidth - topWidth), height).normalized + Vector2.right;

            bevel = bevel.normalized * topBevelSize;

            //Creates bottom edge
            c3.submesh     = 0;
            c3.bottomStart = vertOffset - bottomEdgeSize;
            c3.height      = bottomEdgeSize;
            c3.botWidth    = botWidth - bottomEdgeSize;
            c3.topWidth    = botWidth;
            c3.uvBot       = 0;
            c3.uvTop       = .01f;

            //Sets outer shell values
            c0.submesh     = 0;
            c0.bottomStart = vertOffset;
            c0.height      = height - bevel.y;
            c0.botWidth    = botWidth;
            c0.topWidth    = topWidth;
            c0.uvBot       = 0.01f;
            c0.uvTop       = 1 - .01f;
            c0.rings       = outerEdgeLoops;
            //c0.uvTop = (height) / (6*maxWidth / c0.tiling);
            //if (c0.uvTop > 240 / 512f) {
            //}

            //Set top Bevel
            c4.submesh     = 0;
            c4.bottomStart = vertOffset + height - bevel.y;
            c4.height      = bevel.y;
            c4.botWidth    = topWidth;
            c4.topWidth    = topWidth - bevel.x;
            c4.uvBot       = 1 - .01f;
            c4.uvTop       = 1;

            //Sets top bit values
            c1.submesh     = 1;
            c1.bottomStart = vertOffset + height;
            c1.height      = 0;
            c1.botWidth    = topWidth - bevel.x;
            c1.topWidth    = (topWidth - bevel.x) - thickness * topWidth;
            c1.uvBot       = 0;
            c1.uvTop       = 1;
            c1.rings       = topEdgeLoops;

            //Sets bottom flat bit
            c5.submesh     = 1;
            c5.bottomStart = vertOffset - bottomEdgeSize;
            c5.height      = 0;
            c5.topWidth    = botWidth - bottomEdgeSize;
            c5.botWidth    = Mathf.Min(botWidth - thickness * topWidth, botWidth - bottomEdgeSize);
            c5.uvBot       = 0;
            c5.uvTop       = 1;
            c5.rings       = topEdgeLoops;

            //Sets inner shell values
            c2.submesh     = 2;
            c2.bottomStart = vertOffset + height;
            c2.height      = -height - bottomEdgeSize;
            c2.botWidth    = topWidth - thickness * topWidth;
            c2.topWidth    = Mathf.Min(botWidth - thickness * topWidth, botWidth - bottomEdgeSize);
            c2.uvBot       = 0;
            c2.uvTop       = 1;


            topWidth -= antiZFightSizeIncrease;
            botWidth -= antiZFightSizeIncrease;
        }