The score is now incremented when a coin falls through the PointTrigger.
The score is now incremented when a coin falls through the PointTrigger.

file:a/Coin.cpp -> file:b/Coin.cpp
--- a/Coin.cpp
+++ b/Coin.cpp
@@ -10,7 +10,7 @@
 btCollisionShape* Coin::_coinShape=new btCylinderShape(btVector3(5.0f,0.5f,5.0f));
 
 Coin::Coin(Ogre::Vector3 startPos,Ogre::SceneManager *sceneMngr,btDynamicsWorld *world)
-  : _world(world)
+  : _world(world),_value(1)
 {
   _coinCount++;
 
@@ -39,10 +39,9 @@
   delete _coinBody;
 }
 
-void Coin::remove()
-{ 
-  _coinNode->getParentSceneNode()->removeChild(_coinNode);
-  _world->removeCollisionObject(_coinBody);
+unsigned int Coin::value()
+{
+  return _value;
 }
 
 btCollisionShape* Coin::shape()
@@ -51,3 +50,15 @@
 btRigidBody* Coin::body()
 { return _coinBody; }
 
+void Coin::triggerPoint()
+{
+  _value=0;
+}
+
+void Coin::remove()
+{ 
+  _coinNode->getParentSceneNode()->removeChild(_coinNode);
+  _world->removeCollisionObject(_coinBody);
+}
+
+

file:a/Coin.h -> file:b/Coin.h
--- a/Coin.h
+++ b/Coin.h
@@ -11,13 +11,18 @@
   Coin(Ogre::Vector3 startPos,Ogre::SceneManager *sceneMngr,btDynamicsWorld *world);
   ~Coin();
 
+  unsigned int value();
+
   btCollisionShape *shape();
   btRigidBody* body();
 
+  void triggerPoint();
   void remove();
 private:
   static int _coinCount;
   static btCollisionShape *_coinShape;
+
+  unsigned int _value;
 
   btDynamicsWorld *_world;
 

--- a/CoinGame.cpp
+++ b/CoinGame.cpp
@@ -165,6 +165,20 @@
       for(int i=0; i<numObjectsInGhost;++i)
 	{
 	  btCollisionObject* obj = _pointTrigger->getOverlappingObject(i);
+	  // Locate the coin that triggered this
+	  for(std::vector<Coin*>::iterator iter=_coins.begin();
+	      iter!=_coins.end();
+	      iter++)
+	    {
+	      Coin *coin=(*iter);
+	      if(coin->body()==obj)
+		{ // Found it!
+		  _score+=coin->value();
+		  coin->triggerPoint();
+		  break;
+		}
+	    }
+	  
 	  ///printf("obj[%d] = %p\n",i, obj);
 	}
     }