Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / Game Design & Programming / A Tokamak expert in this room ? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Marmakoide

March 12, 2005, 04:41 AM

Hello

I'am trying to use the Tokamak physics engine. The API seems to be pretty, but the documentation is very short, and only 7 tutorials on the net, only for trivial tasks...

I have two objects a robot and a world. I initialise Tokamak this way :

  1.  
  2. /*
  3. * Tokamak simulator init
  4. */     
  5. neV3 gravity;                          
  6. neSimulatorSizeInfo sizeInfo;
  7.  
  8. // General infos
  9. sizeInfo.rigidBodiesCount = 1;
  10. sizeInfo.animatedBodiesCount = 1;
  11. sizeInfo.geometriesCount = 2 + map->getNbWalls();
  12. sizeInfo.overlappedPairsCount = 2;
  13. sizeInfo.rigidParticleCount = 0;
  14. sizeInfo.constraintsCount = 0;
  15. sizeInfo.terrainNodesStartCount = 0;
  16.  
  17. // Gravity vector
  18. gravity.Set(0.0f, -gravityFieldStrength, 0.0f);
  19. tkSim = neSimulator::CreateSimulator(sizeInfo, NULL, &gravity);
  20.  



- The world is a grid of cube : floor cube or wall cube. I model this in Tokamak with a single AnimatedBody, this way :
  1.  
  2. // The world shape
  3. tkWorld = tkSim->CreateAnimatedBody();
  4. neGeometry* geom = tkWorld->AddGeometry();
  5. geom->SetBoxSize((f32)map->getWidth(), (f32)0.2f, (f32)map->getHeight());
  6. tkWorld->UpdateBoundingInfo();
  7.  
  8. for(int y = 0; y < map->getHeight(); y++)
  9.    for(int x = 0; x < map->getWidth(); x++)
  10.       if (map->getBlock(x, y)->isWall())
  11.         putBox((double)x, (double)y);
  12.  
  13. putBox(double x, double y) {
  14.         neGeometry* geom;      
  15.         neV3 boxSize;
  16.  
  17.         geom = tkWorld->AddGeometry();
  18.         geom->SetBoxSize((f32)1.0, (f32)10.0, (f32)1.0);
  19.         tkWorld->UpdateBoundingInfo();
  20.         neT3 t = geom->GetTransform();
  21.         t.SetIdentity();
  22.         t.pos.Set((f32)x, (f32)0.0, (f32)y);
  23. }      
  24.  


- The robot is a cylinder, defined this way :
  1.  
  2. // Physical definition
  3. robot->body = createCylinder(robot->getDiameter(), 0.2f, robot->getDiameter());
  4. robot->body->SetInertiaTensor(neCylinderInertiaTensor(robot->getDiameter(), 0.2f, robot->getMass()));
  5. robot->body->SetMass((float)robot->getMass());
  6.  
  7. // Robot control
  8. robot->body->AddController(robot->leftThrustGenerator, 0);
  9. robot->body->AddController(robot->rightThrustGenerator, 0);
  10.  


And to make the world/robot collision working :
  1.  
  2. // Setup the robot/world collision
  3. tkSim->GetCollisionTable()->Set(robot->body->GetCollisionID(), tkWorld->GetCollisionID());
  4.  


But the robot have no collisions with the world, the walls are transparents... What's wrong ???

 
Marmakoide

March 13, 2005, 09:34 AM

Okay, I made a little demo to reproduce the problem in controled conditions (OpenGL/SDL demo). I use the 1.20 Tokamak version, this version have a bug with boxes collision. I will be VERY HAPPY is somebody can provide me an older version, 1.10. (Needed to finish my university project...)

 
This thread contains 2 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.