Alvaro Cassinelli
/
skinGames_forktest
just a test
Fork of scoreLight_Advanced by
Diff: rigidLoop.cpp
- Revision:
- 21:bc9b9383f4b6
- Parent:
- 20:8e82b95180e7
- Child:
- 22:d87317d7ca91
diff -r 8e82b95180e7 -r bc9b9383f4b6 rigidLoop.cpp --- a/rigidLoop.cpp Sat Apr 28 15:08:27 2012 +0000 +++ b/rigidLoop.cpp Sun May 06 14:40:19 2012 +0000 @@ -30,6 +30,9 @@ sendingRecenteringAngle=true; sendingAnchorPosition=true; sendingOnlyWhenTouch=true; + + // Gravity field: + gravity.set(.5,0); // (3) Initialize secondary variables depending on the behaviour mode (may be changed afterwards in real time) @@ -268,7 +271,7 @@ // this is very simple: we need to give a force to the centralMass that is OPPOSITE to the recenteringVectorLoop vector centerMass.resetForce(); - if (displaySensingBuffer.lightTouched) { + if (displaySensingBuffer.lightTouched) { // add force; MANY POSSIBILITIES: // (1) Constant in norm: //centerMass.addForce(unitTowardsLight*saccadeRadius*factorBouncingForce); @@ -280,6 +283,9 @@ //centerMass.addForce(recenteringVectorLoop*normRecenteringVector*factorBouncingForce); } + + // Gravity? + centerMass.addForce(gravity*centerMass.mass); // update dynamics for the central mass:: #ifndef VERLET_METHOD @@ -300,8 +306,13 @@ } // OTHER PARTICULAR THINGS: - if (displaySensingBuffer.lightTouched) setColor(0x02); // green on - else setColor(0x00); // green off + if (displaySensingBuffer.lightTouched) { + // setGreenPower(1); // setColor(0x02); // green on + setColor(0x02|blobColor); // set green ON, regardless of the initial color + } else { + // setGreenPower(0); //setColor(0x00); // green off + setColor(blobColor); // set green OFF (IF it was off from the start) + } // change sliding direction (for countour following):