some quick updates for the camera before working on buttons
This commit is contained in:
parent
25bd4ba64e
commit
65a826f2af
@ -194,8 +194,11 @@ void Graphics::resize(glm::uvec2 windowSize) {
|
|||||||
|
|
||||||
glm::mat4 Graphics::buildViewMatrix(Level* level) {
|
glm::mat4 Graphics::buildViewMatrix(Level* level) {
|
||||||
//construct lookAt (cameraPosition = cameraCenter + cameraVector)
|
//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()),
|
return glm::lookAt((level->getCameraCenter()->getPosition() + level->getCamera()->getVector()),
|
||||||
level->getCameraCenter()->getPosition(), glm::vec3(0.0f, 1.0f, 0.0f));
|
level->getCameraCenter()->getPosition(), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Graphics::getFarPlane() {
|
float Graphics::getFarPlane() {
|
||||||
|
@ -38,6 +38,7 @@ void Physics::takeUpdateStep(float timeDiff)
|
|||||||
|
|
||||||
btVector3 dir = cameraBody->getCenterOfMassPosition() - position;
|
btVector3 dir = cameraBody->getCenterOfMassPosition() - position;
|
||||||
cameraBody->applyCentralForce(dir);
|
cameraBody->applyCentralForce(dir);
|
||||||
|
cameraBody->applyCentralForce(btVector3(0,10,0));
|
||||||
|
|
||||||
/*- cameraBody->getCenterOfMassPosition(); // gives vector from player to camera
|
/*- cameraBody->getCenterOfMassPosition(); // gives vector from player to camera
|
||||||
position.normalize();
|
position.normalize();
|
||||||
@ -374,7 +375,7 @@ void Physics::addCamera()
|
|||||||
|
|
||||||
cameraBody = new btRigidBody(info);
|
cameraBody = new btRigidBody(info);
|
||||||
|
|
||||||
cameraBody->setDamping(0.95f,1.0f);
|
cameraBody->setDamping(1,0.5);
|
||||||
|
|
||||||
world->addRigidBody(cameraBody,COL_OBJECTS, objectsPhysicsCollision);
|
world->addRigidBody(cameraBody,COL_OBJECTS, objectsPhysicsCollision);
|
||||||
|
|
||||||
@ -431,6 +432,8 @@ void Physics::updateCameraPos(glm::vec2 mouseMovement, float strength)
|
|||||||
change.setY(mouseMovement.y);
|
change.setY(mouseMovement.y);
|
||||||
change*=strength;
|
change*=strength;
|
||||||
|
|
||||||
|
cameraBody->applyCentralForce(change);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Physics::rollForward(glm::vec3 camPos,float strength)
|
void Physics::rollForward(glm::vec3 camPos,float strength)
|
||||||
|
Loading…
Reference in New Issue
Block a user