some quick updates for the camera before working on buttons

This commit is contained in:
Jasper 2015-01-19 17:12:58 +01:00
parent 93e5c33dfd
commit 275f013c2f
2 changed files with 7 additions and 1 deletions

View File

@ -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() {

View File

@ -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);
}