private void InitClothScene()
        {
            //cloth attributes
            int length = 10;
            int width = 5;
            int lengthSegments = 20;
            int widthSegments = 15;

            //load in a plane
            clothPlane = new TexturedPlane(this, length, width, lengthSegments, widthSegments, @"checkerboard");
            clothPlane.Initialize();

            //create a cloth sim
            float clothMass = 2.0f;
            float structStiffness = 2.0f;
            float structDamping = 0.02f;
            float shearStiffness = 2.0f;
            float shearDamping = 0.02f;
            float bendStiffness = 2.0f;
            float bendDamping = 0.02f;
            clothSim = new ClothSim(this, clothPlane, clothMass, structStiffness, structDamping, shearStiffness, shearDamping, bendStiffness, bendDamping);
            clothSim.ConstraintIterations = 10;

            //add in a global forceGenerators: gravity
            Gravity gravity = new Gravity(new Vector3(0, -9.81f, 0));
            clothSim.AddGlobalForceGenerator(gravity);

            //constrain the two top corners of the cloth so that we can control it
            topLeftCorner = new PointConstraint(clothSim.SimVertices[0].CurrPosition, clothSim.SimVertices[0]);
            clothSim.Constraints.Add(topLeftCorner);
            topRightCorner = new PointConstraint(clothSim.SimVertices[lengthSegments].CurrPosition, clothSim.SimVertices[lengthSegments]);
            clothSim.Constraints.Add(topRightCorner);

            //create an integrator and assign it to the sim
            float drag = 0.01f;
            Integrator integrator = new VerletNoVelocityIntegrator(this, drag);
            clothSim.Integrator = integrator;
        }
        private void InitChainScene()
        {
            //chain attributes
            int numSegments = 30;
            float separation = 0.65f;

            //load in segments
            GameModel[] segments = new GameModel[numSegments];
            for (int i = 0; i < numSegments; i++)
            {
                segments[i] = modelComponent.LoadGameModel("chainSegment");

                //reduce the size of each segment
                segments[i].Scale = 0.3f * Vector3.One;

                //position each segment downwards incrementally to form the chain
                segments[i].TranslateY = -i * separation;

                //rotate the even segments by 90 degrees in Y axis
                segments[i].RotateY = (i % 2) * 90.0f;
            }

            //create a chain sim
            float totalMass = 1.0f;
            float stiffness = 0.3f;
            float damping = 0.01f;
            chainSim = new ChainSim(this, segments, totalMass, stiffness, damping);

            //add in a global force generator: gravity
            Gravity gravity = new Gravity(new Vector3(0, -9.81f * 5, 0));
            chainSim.AddGlobalForceGenerator(gravity);

            //constrain the head point so that we can control it
            chainHeadPoint = new PointConstraint(Vector3.Zero, chainSim.SimObjects[0]);
            chainSim.Constraints.Add(chainHeadPoint);

            //create a integrator and assign it to the sim
            float drag = 0.005f;
            Integrator integrator = new VerletNoVelocityIntegrator(this, drag);
            chainSim.Integrator = integrator;
        }