git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@329 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
99de21bcaa
commit
f2beab0fcf
|
@ -29,7 +29,7 @@ using namespace reactphysics3d;
|
||||||
// Constructor of the class Context
|
// Constructor of the class Context
|
||||||
Context::Context() {
|
Context::Context() {
|
||||||
|
|
||||||
Cube* cube1 = new Cube(Vector3D(11.0,14.0, 4.0), Quaternion(1.0, 1.0, 0.0, 0.0), 4.0, Kilogram(3.0));
|
Cube* cube1 = new Cube(Vector3D(5.0,14.0, 4.0), Quaternion(1.0, 1.0, 0.0, 0.0), 4.0, Kilogram(3.0));
|
||||||
cube1->getRigidBody()->setLinearVelocity(Vector3D(0.0, -5.0, 0.0));
|
cube1->getRigidBody()->setLinearVelocity(Vector3D(0.0, -5.0, 0.0));
|
||||||
|
|
||||||
//Cube* cube2 = new Cube(Vector3D(0.0, 17, 8.0), Quaternion(0.0, 1.0, 0.0, 0.0), 3.0, Kilogram(2.0));
|
//Cube* cube2 = new Cube(Vector3D(0.0, 17, 8.0), Quaternion(0.0, 1.0, 0.0, 0.0), 3.0, Kilogram(2.0));
|
||||||
|
|
|
@ -108,14 +108,14 @@ void Scene::display(const Context& context) const {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
// Draw the bounding volume
|
// Draw the bounding volume
|
||||||
context.getObject(i).getRigidBody()->getOBB().draw();
|
context.getObject(i).getRigidBody()->getOBB()->draw();
|
||||||
|
|
||||||
// Remove the matrix on the top of the matrix stack
|
// Remove the matrix on the top of the matrix stack
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw all the contact points
|
// Draw all the contact points
|
||||||
for (std::vector<Constraint*>::const_iterator it = world->getConstraintListStartIterator(); it != world->getConstraintListEndIterator(); ++it) {
|
for (std::vector<Constraint*>::iterator it = world->getConstraintsBeginIterator(); it != world->getConstraintsEndIterator(); ++it) {
|
||||||
RigidBody* rigidBody1 = dynamic_cast<RigidBody*>((*it)->getBody1());
|
RigidBody* rigidBody1 = dynamic_cast<RigidBody*>((*it)->getBody1());
|
||||||
RigidBody* rigidBody2 = dynamic_cast<RigidBody*>((*it)->getBody2());
|
RigidBody* rigidBody2 = dynamic_cast<RigidBody*>((*it)->getBody2());
|
||||||
rigidBody1->setIsMotionEnabled(false);
|
rigidBody1->setIsMotionEnabled(false);
|
||||||
|
@ -125,13 +125,11 @@ void Scene::display(const Context& context) const {
|
||||||
assert(contact != 0);
|
assert(contact != 0);
|
||||||
|
|
||||||
// Draw the contact points
|
// Draw the contact points
|
||||||
for (unsigned int i=0; i<contact->getPoints().size(); ++i) {
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(contact->getPoints()[i].getX(), contact->getPoints()[i].getY(), contact->getPoints()[i].getZ());
|
glTranslatef(contact->getPoint().getX(), contact->getPoint().getY(), contact->getPoint().getZ());
|
||||||
contact->draw();
|
contact->draw();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Change the buffers
|
// Change the buffers
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
|
|
|
@ -84,7 +84,7 @@ void Simulation::start() {
|
||||||
pEngine->updateDisplayTime(Time(time));
|
pEngine->updateDisplayTime(Time(time));
|
||||||
|
|
||||||
// Update the physics
|
// Update the physics
|
||||||
pEngine->update();
|
pEngine->updateCollision();
|
||||||
|
|
||||||
// Display the actual scene
|
// Display the actual scene
|
||||||
scene.display(context);
|
scene.display(context);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user