示例#1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        protected override void Initialize()
        {
            fixedBall = new Ball(1);
            fixedBall.model = Content.Load<Model>(@"ball");

            fixedBall.Texture = Content.Load<Texture2D>(@"basic_material");
            fixedBall.Position = new Vector3(0, 4, 0);

            ball = new Ball(1);
            ball.Texture = Content.Load<Texture2D>(@"basic_material");
            ball.Position = new Vector3(0, 0, 0);
            ball.model = fixedBall.model;

            ball.Mass = 10;

            cg = new ContactGenerator();
            cg.AddBody(fixedBall);
            cg.AddBody(ball);
            cg.AddConductor(new Cable(fixedBall, ball, 10, 0.7f));

            //////////////////////////////////////////////////
            fixedBall2 = new Ball(1);
            fixedBall2.model = Content.Load<Model>(@"ball");

            fixedBall2.Texture = Content.Load<Texture2D>(@"basic_material");
            fixedBall2.Position = new Vector3(-5, 4, 0);

            ball2 = new Ball(1);
            ball2.Texture = Content.Load<Texture2D>(@"basic_material");
            ball2.Position = new Vector3(-5, 0, 0);
            ball2.model = fixedBall.model;

            ball2.Mass = 10;

            cg.AddBody(fixedBall2);
            cg.AddBody(ball2);
            cg.AddConductor(new Rod(fixedBall2, ball2, 3));

            camera = new Camera(this, new Vector3(0, 0, 0.1f),
                Vector3.Zero, Vector3.Up);
            Components.Add(camera);
            g = new Gravity(new Vector3(0f, -10f, 0f));

            fixedBall.InverseMass = 0;
            fixedBall.InverseInertiaTensor = new Matrix();

            fixedBall2.InverseMass = 0;
            fixedBall2.InverseInertiaTensor = new Matrix();

            base.Initialize();
        }
示例#2
0
        public Rope(float length,ContactGenerator cg,Game game,Gravity gravity)
        {
            Balls = new List<Ball>();
            uint n = (uint)length * 6;

            this.g = gravity;
            this.cg=cg;
            this.game = game;

            Model model=game.Content.Load<Model>(@"ball");
            Texture2D texture=game.Content.Load<Texture2D>(@"basic_material");

            for (int i = 0; i < n; i++)
            {
                Balls.Add(new Ball(0.02f));

                Balls[i].model = model;
                Balls[i].Texture = texture;
                Balls[i].Position = new Vector3(0,-i*0.1f,0.0f);
                Balls[i].InverseMass = 1f;
                //g.AddBody(Balls[i]);
                Balls[i].InverseInertiaTensor = new Matrix();
                //cg.AddBody(Balls[i]);
            }

            //Balls[Balls.Count - 1].Position = new Vector3(2, 0, 3);
            //Balls[(Balls.Count - 1) / 2].Position = new Vector3(1, 0, 3);
            //Balls[0].Position = new Vector3(0, 0, 3);
            Ball b = new Ball(0.02f);
            b.Position = Balls[(Balls.Count - 1) / 2].Position+new Vector3(0,-0.1f,3);
            b.Mass = 1;
            //g.AddBody(b);
            b.InverseInertiaTensor = new Matrix();
            //cg.AddConductor(new Rod(Balls[(Balls.Count - 1)/2], b, 0.1f));
            //cg.AddConductor(new Rod(b,Balls[(Balls.Count - 1) / 2], 0.1f));

            //cg.velocityIterations = n*10;
            //cg.positionIterations = n * 10;
            //cg.friction = 0;
            //cg.restitution = 0.1f;

            for (int i = 0; i < n-1; i++)
            {
                //if (i == (Balls.Count) / 2)//|| i == (Balls.Count - 1) / 2)
                //{
                //    cg.AddConductor(new Rod(Balls[i], b, 0.1f));//,0.6f));
                //    cg.AddConductor(new Rod(b, Balls[i+1], 0.1f));//,0.6f));
                //    continue;
                //}
                //if (i == ((Balls.Count - 1) / 2)+1)
                //{
                //    cg.AddConductor(new Rod(b, Balls[i], 0.1f));//,0.6f));
                //    continue;
                //}

                //if (i % 2 == 0)
                  //  cg.AddConductor(new Cable(Balls[i], Balls[i + 1], 0.1f, 0.3f));//,0.6f));
                //else
                    cg.AddConductor(new Rod(Balls[i], Balls[i + 1], 0.12f));//,0.6f));
            }
        }
示例#3
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        protected override void Initialize()
        {
            balls = new Ball[numberOfballs];
            fixedBall = new Ball(0.5f);
            Model mod = Content.Load<Model>(@"ball");
            Texture2D tex = Content.Load<Texture2D>(@"basic_material");

            g = new Gravity(Vector3.Down * 1);
            fixedBall.InverseMass = 0;
            fixedBall.InverseInertiaTensor = new Matrix();

            fixedBall.model = mod;

            for (int i = 0; i < numberOfballs; i++)
            {
                balls[i] = new Ball(0.1f);

                balls[i].model = mod;

                balls[i].Mass = 10;

                balls[i].InverseInertiaTensor = new Matrix();

                balls[i].Texture = tex;
                fixedBall.Texture = tex;
            }

            balls[0].Position = new Vector3(-0.25f, -1, 0);
            balls[1].Position = new Vector3(0.50f, -1, 0);
            balls[2].Position = new Vector3(1.00f, -1, 0);
            balls[3].Position = new Vector3(1.50f, -1, 0);

            fixedBall.Position = new Vector3(0, 0f, 0);

            cg = new ContactGenerator();

            for (int i = 0; i < numberOfballs; i++)
            {
                cg.AddBody(balls[i]);
                //cg.AddBody(fixedBall);
                cg.AddConductor(new Rod(fixedBall, balls[i], 2));

            }

            //cg.velocityIterations = numberOfballs ;
            //cg.positionIterations = numberOfballs*10 ;
            //cg.friction = .1f;
            //cg.restitution = 0.7f;

            camera = new Camera(this, new Vector3(0, 0, 0.1f), Vector3.Zero, Vector3.Up);
            Components.Add(camera);
            base.Initialize();
        }
示例#4
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        protected override void Initialize()
        {
            //crates = new Crate[NUM_CRATES];

            Ball b = new Ball(2);
            b.Position = Vector3.Up * 1000;

            cg = new ContactGenerator();
            cg.AddBody(b);

            joints = new Joint[NUM_JOINTS];
            balls = new Ball[NUM_BALLS];
            fixedBalls = new Ball[4];
            ground = new Crate(new Vector3(10, 1, 10));

            #region oldcode
            /*
            //Arms
            crates[0] = new Crate(new Vector3(0.3f, 1f, 0.2f));
            crates[1] = new Crate(new Vector3(0.3f, 1f, 0.2f));
            crates[2] = new Crate(new Vector3(0.3f, 1f, 0.2f));
            crates[3] = new Crate(new Vector3(0.3f, 1f, 0.2f));

            crates[4] = new Crate(new Vector3(0.4f, 0.3f, 0.6f));

            crates[5] = new Crate(new Vector3(0.3f, 0.3f, 0.6f));
            crates[6] = new Crate(new Vector3(0.4f, 0.3f, 0.7f));
            crates[7] = new Crate(new Vector3(0.4f, 0.5f, 0.4f));

            //Legs
            crates[8] = new Crate(new Vector3(0.2f, 0.8f, 0.2f));
            crates[9] = new Crate(new Vector3(0.2f, 0.8f, 0.2f));
            crates[10] = new Crate(new Vector3(0.2f, 0.8f, 0.2f));
            crates[11] = new Crate(new Vector3(0.2f, 0.8f, 0.2f));

            crates[0].Position=new Vector3(0,0.9f,-0.5f);
            crates[1].Position = new Vector3(0, 3.159f, -0.56f);
            crates[2].Position = new Vector3(0, 0.993f, 0.5f);
            crates[3].Position = new Vector3(0, 3.15f, 0.56f);
            crates[4].Position = new Vector3(-0.054f, 4.683f, 0.013f);
            crates[5].Position = new Vector3(0.043f, 5.603f, 0.013f);
            crates[6].Position = new Vector3(0, 6.485f, 0.013f);
            crates[7].Position = new Vector3(0, 7.759f, 0.013f);
            crates[8].Position = new Vector3(0, 5.946f, -1.066f);
            crates[9].Position = new Vector3(0, 4.024f, -1.066f);
            crates[10].Position = new Vector3(0, 5.946f, 1.066f);
            crates[11].Position = new Vector3(0, 4.024f, 1.066f);

            for (int i = 0; i < NUM_CRATES; i++)
            {
                crates[i].Mass = 1;
                crates[i].Position = Vector3.Zero;
            }

            //right leg
            joints[0]=new Joint(crates[0],crates[1],new Vector3(0,1,0),new Vector3(0,-1,0),0.15f);

            //Left leg
            joints[1]=new Joint(crates[2],crates[3],new Vector3(0,1,0),new Vector3(0,-1,0),0.15f);

            //right arm
            joints[2]=new Joint(crates[9],crates[8],new Vector3(0,1,0),new Vector3(0,-1,0),0.15f);

            //left arm
            joints[3]=new Joint(crates[8],crates[1],new Vector3(0,1,0),new Vector3(0,-1,0),0.15f);

            //stomach to waist
            joints[4]=new Joint(crates[4],crates[5],new Vector3(0.05f,0.5f,0),new Vector3(-0.04f,-0.45f,0),0.15f);

            //
            joints[5]=new Joint(crates[5],crates[6],new Vector3(-0.04f,0.4f,0),new Vector3(0,-4,0),0.15f);

            joints[6]=new Joint(crates[6],crates[7],new Vector3(0,0.5f,0),new Vector3(0,-0.7f,0),0.15f);

            joints[7]=new Joint(crates[1],crates[4],new Vector3(0,1,0),new Vector3(0,-0.45f,-.5f),0.15f);

            joints[8]=new Joint(crates[3],crates[4],new Vector3(0,1,0),new Vector3(0,-0.45f,0.5f),0.15f);

            joints[9]=new Joint(crates[6],crates[8],new Vector3(0,0.3f,-.8f),new Vector3(0,0.8f,.3f),0.15f);

            joints[10]=new Joint(crates[6],crates[10],new Vector3(0,0.3f,0.8f),new Vector3(0,0.8f,-0.3f),0.15f);
            */
            #endregion

            #region
            ////Head
            //crates[0] = new Crate(new Vector3(0.1f / 2f, 0.1f / 2f, 0.1f / 2f));

            ////Arms
            //crates[1] = new Crate(new Vector3(0.1f / 2f, 0.2f / 2f, 0.1f / 2f));
            //crates[2] = new Crate(new Vector3(0.1f / 2f, 0.3f / 2f, 0.1f / 2f));
            //crates[3] = new Crate(new Vector3(0.1f / 2f, 0.2f / 2f, 0.1f / 2f));
            //crates[4] = new Crate(new Vector3(0.1f / 2f, 0.3f / 2f, 0.1f / 2f));

            ////Shoulder
            //crates[5] = new Crate(new Vector3(0.5f / 2f, 0.1f / 2f, 0.1f / 2f));

            ////chest
            //crates[6] = new Crate(new Vector3(0.4f / 2f, 0.1f / 2f, 0.1f / 2f));

            ////Stomach
            //crates[7] = new Crate(new Vector3(0.4f / 2f, 0.1f / 2f, 0.1f / 2f));

            ////Legs
            //crates[8] = new Crate(new Vector3(0.1f / 2f, 0.2f / 2f, 0.1f / 2f));
            //crates[9] = new Crate(new Vector3(0.1f / 2f, 0.2f / 2f, 0.1f / 2f));
            //crates[10] = new Crate(new Vector3(0.1f / 2f, 0.2f / 2f, 0.1f / 2f));
            //crates[11] = new Crate(new Vector3(0.1f / 2f, 0.2f / 2f, 0.1f / 2f));

            ////Head
            //crates[0].Position = new Vector3(0, 0.45f, 0);

            ////Arms
            //crates[1].Position = new Vector3(0.35f, 0.25f, 0);
            //crates[2].Position = new Vector3(0.35f, -.05f, 0);
            //crates[3].Position = new Vector3(-0.35f, .25f, 0);
            //crates[4].Position = new Vector3(-0.35f, -0.05f, 0);

            ////Shoulder
            //crates[5].Position = new Vector3(0, 0.3f, -.05f);

            ////chest
            //crates[6].Position = new Vector3(0, 0.15f, 0);

            ////Center Stomach
            //crates[7].Position = new Vector3(0, 0f, 0.05f);

            ////legs
            //crates[8].Position = new Vector3(0.15f, -0.2f, 0);
            //crates[9].Position = new Vector3(0.15f, -0.45f, 0);
            //crates[10].Position = new Vector3(-0.15f, -0.2f, 0);
            //crates[11].Position = new Vector3(-0.15f, -0.45f, 0);

            ////Head and shoulders :)
            //joints[0] = new Joint(crates[0], crates[5], new Vector3(0, -0.05f, -0.05f), new Vector3(0, 0.05f, 0), 0.05f);

            ////right arm
            //joints[1] = new Joint(crates[1], crates[2], new Vector3(0, -0.1f, 0.05f), new Vector3(0, 0.15f, 0), 0.05f);

            ////left arm
            //joints[2] = new Joint(crates[3], crates[4], new Vector3(0, -0.1f, 0.05f), new Vector3(0, 0.15f, 0), 0.05f);

            ////right leg
            //joints[3] = new Joint(crates[8], crates[9], new Vector3(0, -0.1f, 0.05f), new Vector3(0, 0.1f, 0), 0.05f);

            ////left leg
            //joints[4] = new Joint(crates[10], crates[11], new Vector3(0, -0.1f, 0.05f), new Vector3(0, 0.1f, 0), 0.05f);

            ////right arm with shoulders
            //joints[5] = new Joint(crates[5], crates[1], new Vector3(.25f, 0.05f, 0), new Vector3(-0.05f, 0.1f, 0), 0.05f);

            ////left arm with shoulders
            //joints[6] = new Joint(crates[5], crates[3], new Vector3(-.25f, 0.05f, 0), new Vector3(0.05f, 0.1f, 0), 0.05f);

            //joints[7] = new Joint(crates[5], crates[6], new Vector3(0, -0.05f, 0.05f), new Vector3(0, 0.05f, 0), 0.05f);

            //joints[8] = new Joint(crates[6], crates[7], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, -.05f), 0.05f);

            //joints[9] = new Joint(crates[7], crates[8], new Vector3(.15f, -0.05f, 0), new Vector3(0, 0.1f, 0), 0.05f);

            //joints[10] = new Joint(crates[7], crates[10], new Vector3(-.15f, -0.05f, 0), new Vector3(0, 0.1f, 0), 0.05f);
            #endregion

            #region newBall
            balls[0] = new Ball(0.1f);
            balls[1] = new Ball(0.15f);
            balls[2] = new Ball(0.15f);
            balls[3] = new Ball(0.05f);
            balls[4] = new Ball(0.05f);
            balls[5] = new Ball(0.05f);
            balls[6] = new Ball(0.05f);
            balls[7] = new Ball(0.05f);
            balls[8] = new Ball(0.05f);
            balls[9] = new Ball(0.05f);
            balls[10] = new Ball(0.05f);
            balls[11] = new Ball(0.05f);
            balls[12] = new Ball(0.05f);
            balls[13] = new Ball(0.05f);
            balls[14] = new Ball(0.05f);
            fixedBalls[0] = new Ball(0.05f);
            fixedBalls[1] = new Ball(0.05f);
            fixedBalls[2] = new Ball(0.05f);
            fixedBalls[3] = new Ball(0.05f);
            #endregion

            #region position
            balls[0].Position = new Vector3(0, 0.6f, 0);
            balls[1].Position = new Vector3(0, 0.3f, 0);
            balls[2].Position = new Vector3(0, -0.05f, 0);

            balls[3].Position = new Vector3(0.25f, 0.3f, 0);
            balls[4].Position = new Vector3(0.25f, 0.15f, 0);
            balls[5].Position = new Vector3(0.25f, 0, 0);
            balls[6].Position = new Vector3(-0.25f, 0.3f, 0);
            balls[7].Position = new Vector3(-0.25f, 0.15f, 0);
            balls[8].Position = new Vector3(-0.25f, 0, 0);

            balls[9].Position = new Vector3(0.1f, -.25f, 0);
            balls[10].Position = new Vector3(0.1f, -.4f, 0);
            balls[11].Position = new Vector3(0.1f, -.55f, 0);
            balls[12].Position = new Vector3(-0.1f, -.25f, 0);
            balls[13].Position = new Vector3(-0.1f, -.4f, 0);
            balls[14].Position = new Vector3(-0.1f, -.55f, 0);

            fixedBalls[0].Position = new Vector3(0.7f, 0.6f, 0);
            fixedBalls[1].Position = new Vector3(-0.7f, 0.6f, 0);
            fixedBalls[2].Position = new Vector3(0.7f, -1, 0);
            fixedBalls[3].Position = new Vector3(-0.7f, -1, 0);

            ground.Position = new Vector3(0, -3, 0);
            #endregion
            #region Masses
            balls[0].Mass = 5;
            balls[1].Mass = 5;
            balls[2].Mass = 5;
            balls[3].Mass = 1;
            balls[4].Mass = 1;
            balls[5].Mass = 1;
            balls[6].Mass = 1;
            balls[7].Mass = 1;
            balls[8].Mass = 1;
            balls[9].Mass = 1;
            balls[10].Mass = 1;
            balls[11].Mass = 1;
            balls[12].Mass = 1;
            balls[13].Mass = 1;
            balls[14].Mass = 1;
            #endregion

            //head and shoulder :)
            joints[0] = new Joint(balls[0], balls[1], new Vector3(0, -0.1f,0f), new Vector3(0, 0.15f, 0), 0.05f);

            joints[1] = new Joint(balls[1], balls[2], new Vector3(0, -0.15f, 0), new Vector3(0, 0.15f, 0), 0.05f);

            //right arm with shoulders
            joints[2] = new Joint(balls[1], balls[3], new Vector3(0.1f, 0.1f, 0), new Vector3(-0.04f, 0.03f, 0), 0.05f);

            //left arm with shoulders
            joints[3] = new Joint(balls[1], balls[6], new Vector3(-0.1f, 0.1f, 0), new Vector3(0.04f, 0.03f, 0), 0.05f);

            //right arm
            joints[4] = new Joint(balls[3], balls[4], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);
            joints[5] = new Joint(balls[4], balls[5], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);

            //left arm
            joints[6] = new Joint(balls[6], balls[7], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);
            joints[7] = new Joint(balls[7], balls[8], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);

            //Stomach with right leg
            joints[8] = new Joint(balls[2], balls[9], new Vector3(0.1f, -0.15f, 0), new Vector3(0, 0.05f, 0), 0.05f);

            //Stomach with left leg
            joints[9] = new Joint(balls[2], balls[12], new Vector3(-.1f, -0.15f, 0), new Vector3(0, 0.05f, 0), 0.05f);

            //right leg
            joints[10] = new Joint(balls[9], balls[10], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);
            joints[11] = new Joint(balls[10], balls[11], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);

            joints[12] = new Joint(balls[12], balls[13], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);
            joints[13] = new Joint(balls[13], balls[14], new Vector3(0, -0.05f, 0), new Vector3(0, 0.05f, 0), 0.05f);

            Model model = this.Content.Load<Model>(@"ball");
            Texture2D texture = this.Content.Load<Texture2D>(@"basic_material");

            for (int i = 0; i < NUM_BALLS; i++)
            {
                balls[i].model = model;
                balls[i].Texture = texture;
                cg.AddBody(balls[i]);
                //balls[i].Mass = 1;
            }

            for (int i = 0; i < 4; i++)
            {
                fixedBalls[i].Lock();
                fixedBalls[i].model = model;
                fixedBalls[i].Texture = texture;
            }

            cg.AddConductor(new Cable(balls[5], fixedBalls[0], (balls[5].Position - fixedBalls[0].Position).Length(), 0.5f));
            cg.AddConductor(new Cable(balls[8], fixedBalls[1], (balls[8].Position - fixedBalls[1].Position).Length(), 0.5f));
            cg.AddConductor(new Cable(balls[11], fixedBalls[2], (balls[11].Position - fixedBalls[2].Position).Length(), 0.5f));
            cg.AddConductor(new Cable(balls[14], fixedBalls[3], (balls[14].Position - fixedBalls[3].Position).Length(), 0.5f));

            ground.Lock();

            for (int i = 0; i < NUM_JOINTS; i++)
                cg.AddJoint(joints[i]);
            cg.AddBody(ground);
                camera = new Camera(this, new Vector3(0, 0, 0.1f),
                    Vector3.Zero, Vector3.Up);
            Components.Add(camera);
            g = new Gravity(new Vector3(0f, -1f, 0f));

            base.Initialize();
        }
示例#5
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        protected override void Initialize()
        {
            balls = new Ball[10];
            fixedBalls = new Ball[10];
            Model mod = Content.Load<Model>(@"ball");
            Texture2D tex = Content.Load<Texture2D>(@"basic_material");

            g = new Gravity(Vector3.Down );

            for (int i = 0; i < 10; i++)
            {
                balls[i] = new Ball(0.2f);
                fixedBalls[i] = new Ball(0.1f);

                balls[i].model = mod;
                fixedBalls[i].model = mod;

                balls[i].Mass = 2;
                fixedBalls[i].InverseMass = 0;
                fixedBalls[i].InverseInertiaTensor = new Matrix();
                balls[i].InverseInertiaTensor = new Matrix();
                g.AddBody(balls[i]);

                balls[i].Texture = tex;
                fixedBalls[i].Texture = tex;
            }

            balls[0].Position = new Vector3(0, 0, 0);
            balls[1].Position = new Vector3(1, 0, 0);
            balls[2].Position = new Vector3(2, 0, 0);
            balls[3].Position = new Vector3(3, 0, 0);
            balls[4].Position = new Vector3(4, 0, 0);
            balls[5].Position = new Vector3(0, 0, 3);
            balls[6].Position = new Vector3(1, 0, 3);
            balls[7].Position = new Vector3(2, 0, 3);
            balls[8].Position = new Vector3(3, 0, 3);
            balls[9].Position = new Vector3(4, 0, 3);

            fixedBalls[0].Position = new Vector3(0, 1.0f, 0);
            fixedBalls[1].Position = new Vector3(1, 1f, 0);
            fixedBalls[2].Position = new Vector3(2, 1f, 0);
            fixedBalls[3].Position = new Vector3(3, 1f, 0);
            fixedBalls[4].Position = new Vector3(4, 1f, 0);
            fixedBalls[5].Position = new Vector3(0, 1f, 3);
            fixedBalls[6].Position = new Vector3(1, 1f, 3);
            fixedBalls[7].Position = new Vector3(2, 1f, 3);
            fixedBalls[8].Position = new Vector3(3, 1f, 3);
            fixedBalls[9].Position = new Vector3(4, 1f, 3);

            cg = new ContactGenerator();

            for (int i = 0; i < 10; i++)
            {
                cg.AddBody(balls[i]);
                cg.AddBody(fixedBalls[i]);
                cg.AddConductor(new Cable(fixedBalls[i], balls[i], 2, 0.7f));

            }

            for (int i = 0; i < 5; i++)
            {
                cg.AddConductor(new Rod(balls[i], balls[i + 5], 3));

            }

            //cg.velocityIterations = 8;
            //cg.friction = 0;
            //cg.restitution = 0.5f;

            for (int i = 0; i < 4; i++)
            {
                cg.AddConductor(new Rod(balls[i], balls[i + 1], 1));
                cg.AddConductor(new Rod(balls[9 - i], balls[9 - i - 1], 1));
            }
                camera = new Camera(this, new Vector3(0, 0, 0.1f),Vector3.Zero, Vector3.Up);
            Components.Add(camera);

            base.Initialize();
        }