anchor.diff:    gridSize = 18*2; //13;
   
   Type
  +  ClothSystem = Class;
  +  
     ClothSpring = Object
  -  	//Indices of the Particles at either end of the spring
  -	  ball1, ball2:Integer;
  -
  -  	//Tension in the spring
  -	  tension:Single;
  -
  -	  springConstant:Single;
  -  	naturalLength:Single;
  -
  -    Procedure Init(Index, PID1, PID2: Integer; Len: Single);
  +    Protected
  +      _System:ClothSystem;
  +      _Index:Integer;
  +
  +    	//Indices of the Particles at either end of the spring
  +  	  ball1, ball2:Integer;
  +
  +    	//Tension in the spring
  +	    tension:Single;
  +
  +  	  springConstant:Single;
  +    	naturalLength:Single;
  +
  +    Procedure Init(PID1, PID2: Integer; Len: Single);
     End;
   
     ClothParticle = Object
  
positive.code:   For J:=0 To Pred(gridSize-1) Do
      For I:=0 To Pred(gridSize) Do
      Begin
  			springs[currentSpring].Init(currentSpring, J*gridSize+I, (J+1)*gridSize+I, naturalLength);
  			Inc(currentSpring);
      End;
  
  
negative.code:         Force := gravity;
  
  				//Loop through springs
          //For J:=0 To Pred(_SpringCount) Do
          For K:=0 To Pred(_Particles[I].SpringCount) Do
  				Begin
            J := _Particles[I].Springs[K];
  					//If this ball is "ball1" for this spring, add the tension to the force
  					If(_springs[j].ball1 = i)  Then
  					Begin
  						tensionDirection :=	VectorSubtract(_Particles[_springs[j].ball2].CurrentPosition, _Particles[i].CurrentPosition);
  						tensionDirection.Normalize();
  
              tensionDirection.Scale(_springs[j].tension);
  						force.Add(tensionDirection);
  					End;
  
  					//Similarly if the ball is "ball2"
  					if(_springs[j].ball2=i) Then
  					Begin
  						tensionDirection :=	VectorSubtract(_Particles[_springs[j].ball1].CurrentPosition, _Particles[i].CurrentPosition);
  						tensionDirection.Normalize();
  
              tensionDirection.Scale(_springs[j].tension);
  						force.Add(tensionDirection);
  					End;
          End;
  
  				//Calculate the acceleration
  				acceleration := VectorScale(force, _Particles[i].InverseMass);
  
  				//Update velocity
  				_Particles[i].NextVelocity := VectorAdd(_Particles[i].CurrentVelocity, VectorScale(acceleration, timePassedInSeconds));
  
  				//Damp the velocity
  				_Particles[i].NextVelocity.Scale(dampFactor);
  
  				//Calculate new position
          //Force := VectorAdd(VectorScale(Particles[i].NextVelocity, 0.5), VectorScale(Particles[i].CurrentVelocity, 0.5));
          Force := _Particles[i].NextVelocity;
  
          Force.Scale(timePassedInSeconds);
  				_Particles[i].NextPosition := VectorAdd(_Particles[i].CurrentPosition, Force);
  
  				//Check against sphere (at origin)
          P := VectorSubtract(_Particles[i].NextPosition, Sphere.Position);
  				if (P.LengthSquared < Sqr(sphereRadius*1.08)) Then
          Begin
  					P.Normalize();
            P.Scale(sphereRadius*1.08);
            _Particles[i].NextPosition := VectorAdd(P, Sphere.Position);
          End;
  
  				//Check against floor
  				if(_Particles[i].NextPosition.y <= -sphereRadius * 0.92) Then
          Begin
  					_Particles[i].NextPosition.y := -sphereRadius * 0.92;
            _Particles[i].NextVelocity.y := 0;
          End;
  
  			End;
  		End;
  
  		//Swap the currentParticles and newParticles pointers
  		For I:=0 To Pred(_ParticleCount) Do
      Begin
        _Particles[i].CurrentPosition := _Particles[i].NextPosition;
  			_Particles[i].CurrentVelocity := _Particles[i].NextVelocity;
      End;
  	End;
  
  	//Calculate the normals if we have updated the positions
  	If(updateMade) Then
      Self.UpdateMesh();
  End;
  
  Procedure ClothSystem.Release;
  Begin
    ReleaseObject(_Mesh);
  End;
  
  {$IFDEF IPHONE}
  