[ODE] help in Get functions

Joao Pinto joao_icaro at yahoo.com
Sun Mar 5 05:52:21 MST 2006


I am a newbie with ODE and cpp for that matter, so my question can be very stupid, anyway I can't seem to sort it out.
   
  I have made a very simple program that only creates a world, sets a gravity vector and creates an object at a specific location. Then I use the dWorldGetGravity and dBodyGetPosition functions to check if the changes where actually made in the simulation. However, when I cout to the screen the results of the vectors only the 1st position is actually changed. The rest still has my initialization data. This happens in the gravity vector as well as in the pointer of the position.
   
  Can anyone help me...? I'm sure this is a very basic stuff...
   
  Thank you very much
   
  João
   
  here is the code:
   
  //*******************************************************
   
  using namespace std;
  int main(int argc, char *argv[])
{
        
    dReal x, y, z;
  
      //init values to be updated with the real values in the world
    gravity[0]=1111111.;
    gravity[1]=1111111.;
    gravity[2]=1111111.;
  
    world = dWorldCreate();
  
    dWorldSetGravity (world,x=1.,y=2.,z=3.);
      body1 = dBodyCreate (world);
    dBodySetPosition   (body1, 1., 2., 3.);
      const dReal *pos = dBodyGetPosition (body1);  
    cout << "\n\npos " << pos[0]<< "\t" << pos[1]<< "\t" << pos[2];
      
    dWorldGetGravity (world,gravity);
      cout << "\n\ngravity: " << gravity[0]<< "\t" <<gravity[1]<< "\t" <<gravity[2] << endl << endl; 
      dWorldDestroy (world);
      system("PAUSE");
    return EXIT_SUCCESS;
}
  //*******************************************************


_________________________________ 
BECAUSE WE CAN! 
 
phone number: 96 843 15 16
 
Follow this link to my homepage:
http://protocol7.no-ip.com/joao/myhomepage.htm




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060305/03a7c296/attachment.htm


More information about the ODE mailing list