diff --git a/graphics.cc b/graphics.cc index f3be9d8..af4f696 100644 --- a/graphics.cc +++ b/graphics.cc @@ -194,8 +194,11 @@ void Graphics::resize(glm::uvec2 windowSize) { glm::mat4 Graphics::buildViewMatrix(Level* level) { //construct lookAt (cameraPosition = cameraCenter + cameraVector) + //return glm::lookAt(level->getCamera()->getPosition(), level->getCamera()->getPosition() + level->getCamera()->getDirection(), glm::vec3(0.0f, 1.0f, 0.0f)); + return glm::lookAt((level->getCameraCenter()->getPosition() + level->getCamera()->getVector()), level->getCameraCenter()->getPosition(), glm::vec3(0.0f, 1.0f, 0.0f)); + } float Graphics::getFarPlane() { diff --git a/physics.cc b/physics.cc index 6e3ffed..394cab7 100644 --- a/physics.cc +++ b/physics.cc @@ -38,6 +38,7 @@ void Physics::takeUpdateStep(float timeDiff) btVector3 dir = cameraBody->getCenterOfMassPosition() - position; cameraBody->applyCentralForce(dir); + cameraBody->applyCentralForce(btVector3(0,10,0)); /*- cameraBody->getCenterOfMassPosition(); // gives vector from player to camera position.normalize(); @@ -374,7 +375,7 @@ void Physics::addCamera() cameraBody = new btRigidBody(info); - cameraBody->setDamping(0.95f,1.0f); + cameraBody->setDamping(1,0.5); world->addRigidBody(cameraBody,COL_OBJECTS, objectsPhysicsCollision); @@ -430,6 +431,8 @@ void Physics::updateCameraPos(glm::vec2 mouseMovement, float strength) change = btCross(btVector3(0,1,0),change); change.setY(mouseMovement.y); change*=strength; + + cameraBody->applyCentralForce(change); }