Permalink
Browse files

Objects move, but problems

  • Loading branch information...
1 parent aa59f8c commit 977e5b7e45bac84dafe9a2242f4ef62fccf0f95e @IanLilleyT IanLilleyT committed Apr 9, 2012
Showing with 4 additions and 3 deletions.
  1. +1 −1 src/Physics/PhysicsObject.h
  2. +3 −2 src/main.cpp
@@ -47,6 +47,7 @@ class PhysicsObject
//Transformation methods
glm::mat4 getTransformationMatrix();
+ void updateTransformationMatrix();
//Translation
glm::vec3 getTranslation();
@@ -69,7 +70,6 @@ class PhysicsObject
private:
void createRigidBody(float mass, float friction, float restitution);
- void updateTransformationMatrix();
Mesh* attachedMesh;
btRigidBody* rigidBody;
View
@@ -164,13 +164,13 @@ void initPhysics()
//ground plane
PhysicsObject* floor = new PhysicsObject();
- floor->initializeBox(glm::vec3(10,1,10),1,1,0.5f);
+ floor->initializeBox(glm::vec3(10,1,10),0,0,0.5f);
floor->setTranslationZ(0.0f);
floor->attachMesh(Globals::meshLibrary.getMesh(1));
//ball
PhysicsObject* ball = new PhysicsObject();
- ball->initializeSphere(0.1f,1.0f,0.5f,0.5f);
+ ball->initializeSphere(0.5f,1.0f,1.0f,0.1f);
ball->setTranslationY(3.0f);
ball->attachMesh(Globals::meshLibrary.getMesh(3));
@@ -213,6 +213,7 @@ void enterFrame()
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
PhysicsObject* object = objects.at(i);
+ object->updateTransformationMatrix();
glm::mat4 model = object->getTransformationMatrix();
glm::mat4 view = Globals::viewMatrix;
glm::mat4 modelView = view * model;

0 comments on commit 977e5b7

Please sign in to comment.