Alvaro Cassinelli
/
skinGames_forktest
just a test
Fork of scoreLight_Advanced by
Diff: rigidLoop.cpp
- Revision:
- 22:d87317d7ca91
- Parent:
- 21:bc9b9383f4b6
- Child:
- 24:4e52031a495b
--- a/rigidLoop.cpp Sun May 06 14:40:19 2012 +0000 +++ b/rigidLoop.cpp Sat Jun 02 06:38:12 2012 +0000 @@ -86,7 +86,7 @@ createLoopFromScafold(); slidingDirection=true; // For contour following (will change direction when touching wall) - speedContourFollowing=1.3*saccadeRadius; + speedContourFollowing=1.1*saccadeRadius; justSearched=false; // per-blob mirror delay: ONLY USEFUL FOR ELASTIC BLOBS, because otherwise it can be corrected by "angleCorrection" @@ -107,13 +107,13 @@ //setColor(0x07);//0x04+0x02>>i); setColor(0x04); - saccadeRadius=85; + saccadeRadius=40+rand()%20; // default (initial) shape (the scafold belongs to the base class): bluePrint.buildCircularScafold(saccadeRadius, vector2Dd(0,0), 18); //(float _radius, vector2D _pos,vector2D _vel, int _numScafoldPoints); // Numeric parameters for the simulated mechanical system: - massCenter=0.0012; - dampMotionCenterMass=0.0005;//0.00015;//00003; + massCenter=0.0008+0.000005*(rand()%100); + dampMotionCenterMass=0.00045;//0.00015;//00003; factorBouncingForce=0.0018; // this is because we will use a force on the central mass // Finally, we can create the loop (not much to do in this case, only set the central position, and some other things): @@ -284,8 +284,13 @@ } - // Gravity? - centerMass.addForce(gravity*centerMass.mass); + // Gravity? - side or central attraction? + // centerMass.addForce(gravity*centerMass.mass); + // or central spring attraction; + vector2Df centerAttraction(CENTER_AD_MIRROR_X, CENTER_AD_MIRROR_X); + vector2Df dist=centerMass.pos-centerAttraction; + centerMass.addForce(-dist*centerMass.mass*0.0007); + // update dynamics for the central mass:: #ifndef VERLET_METHOD @@ -299,10 +304,8 @@ // do collision damping: centerMass.setSpeed(centerMass.getSpeed()*0.99); } - - + break; - } // OTHER PARTICULAR THINGS: