void MyController::onCollision(CollisionEvent &evt) { 

  Colli = true; 
  counter ++ ; 

  SimObj *target = getObj("box_001");
  SimObj *toolName = getObj("TShapeTool_001");


  if(Colli && counter == 1 )
  {
      toolName->getLinearVelocity(toolVelAtHit);
      target->getLinearVelocity(targetVelAtHit);
      cout << "The tool velocity is " << toolVelAtHit.x() << " , " << toolVelAtHit.z() << endl;
      cout << "The target velocity is " << targetVelAtHit.x() << " , " << targetVelAtHit.z() << endl;
      myfile << toolVelAtHit.x() << " , " << toolVelAtHit.z() << " , " ;
      myfile << targetVelAtHit.x() << " , " << targetVelAtHit.z() << " , " ;
      Colli = false;

  }


}
double MyController::onAction(ActionEvent &evt) {  

  SimObj *obj = getObj(myname());  //obtaining handle to the agent  
  obj->setLinearVelocity(0,0,100); //apply the linear velocity 20[m/s] in Z axis  
  Vector3d currentVelocity;
  obj->getLinearVelocity(currentVelocity);
  
  if (myfile.is_open() && (evt.time() < 15) )
  {
  		myfile << currentVelocity.x() << " , "  <<  currentVelocity.z() << "\n" ;
  }
  if(evt.time() > 15)
  {
  	exit(0);
  }

  return 0.00001;    
      
}