git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@110 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2009-02-25 17:18:48 +00:00
parent 84145e5b98
commit 3e2ea5acd9

View File

@ -26,8 +26,7 @@
using namespace reactphysics3d; using namespace reactphysics3d;
// Constructor of the class Simulation // Constructor of the class Simulation
Simulation::Simulation() Simulation::Simulation() :world(new DynamicWorld(Vector3D(0.0, -9.81, 0.0))), engine(world, Time(0.01)) {
:world(new DynamicWorld(Vector3D(0.0, -9.81, 0.0))), engine(world, Time(0.01)){
simRunning = false; simRunning = false;
mouseButtonPressed = false; mouseButtonPressed = false;
nbFrame = 0; nbFrame = 0;
@ -52,7 +51,7 @@ void Simulation::start() {
// Add every rigid body to the dynamic world // Add every rigid body to the dynamic world
for (int i=0; i<context.getNbObjects(); ++i) { for (int i=0; i<context.getNbObjects(); ++i) {
world->addBody(context.getObject(i).getRigidBody()); world->addBody(context.getObject(i).getRigidBody());
} }
// Activation of the simulation // Activation of the simulation
simRunning = true; simRunning = true;
@ -73,6 +72,7 @@ void Simulation::start() {
double time = SDL_GetTicks()/1000.0; double time = SDL_GetTicks()/1000.0;
std::cout << "Time : " << time << std::endl; std::cout << "Time : " << time << std::endl;
// Update the display time // Update the display time
engine.updateDisplayTime(Time(time)); engine.updateDisplayTime(Time(time));
@ -86,6 +86,7 @@ void Simulation::start() {
computeFps(); computeFps();
std::cout << "FPS : " << fps << std::endl; std::cout << "FPS : " << fps << std::endl;
/*
BodyState state = context.getObject(0).getRigidBody()->getInterpolatedState(); BodyState state = context.getObject(0).getRigidBody()->getInterpolatedState();
Vector3D velocity = context.getObject(0).getRigidBody()->getInterpolatedState().getAngularVelocity(); Vector3D velocity = context.getObject(0).getRigidBody()->getInterpolatedState().getAngularVelocity();
//std::cout << "Velocity 0 : " << velocity.getX() << ", " << velocity.getY() << ", " << velocity.getZ() << ")" << std::endl; //std::cout << "Velocity 0 : " << velocity.getX() << ", " << velocity.getY() << ", " << velocity.getZ() << ")" << std::endl;
@ -112,6 +113,7 @@ void Simulation::start() {
double z2 = state2.getPosition().getZ(); double z2 = state2.getPosition().getZ();
std::cout << "Position Cube 2: (" << x2 << ", " << y2 << ", " << z2 << ")" << std::endl; std::cout << "Position Cube 2: (" << x2 << ", " << y2 << ", " << z2 << ")" << std::endl;
std::cout << "quaternion orientation 2 : " << velocity2.getX() << ", " << velocity2.getY() << ", " << velocity2.getZ() << ", " << velocity2.getW() << ")" << std::endl;; std::cout << "quaternion orientation 2 : " << velocity2.getX() << ", " << velocity2.getY() << ", " << velocity2.getZ() << ", " << velocity2.getW() << ")" << std::endl;;
*/
} }
} }