Your best "pal" when push comes to shove....
If you wish to use all of PAL's extended functionality:
Microsoft:
GNU
Try the simple examples. Then take a look at palFactory and follow the documentation links!
PF->SelectEngine(szEngine); //szEngine is the name of the engine you wish to use. eg:"ODE" palPhysics *pp = PF->CreatePhysics(); //create the main physics class pp->Init(0,-9.8f,0); //initialize it, set the main gravity vector palTerrainPlane *pt= PF->CreateTerrainPlane(); //create the ground pt->Init(0,0,0,50.0f); //initialize it, set its location to 0,0,0 and minimum size to 50 palBox *pb = PF->CreateBox(); //create a box pb->Init(0,5,0, 1,1,1, 1); //initialize it, set its location to 0,5,0 (five units up in the air), set dimensions to 1x1x1 and its mass to 1 while (!quit) { //loop until done pp->Update(0.02f); //update the physics engine. advance the simulation time by 0.02 palMatrix4x4 m; m=pb->GetLocationMatrix(); //get the location of the box (transformation matrix) //display the box } PF->Cleanup(); //we are done with the physics. clean up.
palXMLFactory px; px.LoadXML(szFilename); //eg:"physics.xml" palPhysics *pp = palGetObject<palPhysics>("Physics"); //get the physics engine described in the XML file palBox *pb = palGetObject<palBox>("box0"); //get the box described in the XML file - all objects can also be accessed via a public vector array in the XML factory while (!quit) { //loop until done pp->Update(0.02f); //update the physics engine. advance the simulation time by 0.02 palMatrix4x4 m; m=pb->GetLocationMatrix(); //get the location of the box (transformation matrix) //display the box } PF->Cleanup(); //we are done with the physics. clean up.
Diagrams created by Martin Sawtell.
Some code based from ODE and MESA libraries.