modified the update in level.cc. Now the ball no longer goes bouncy.
This commit is contained in:
parent
b7718d73e8
commit
ef9c089d91
22
level.cc
22
level.cc
@ -57,7 +57,6 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
||||
}
|
||||
|
||||
void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) {
|
||||
physics.takeUpdateStep(runTimeSinceLastUpdate);
|
||||
|
||||
// Ignore first two mouse updates, because they are incorrect
|
||||
// DON'T try to move this functionallity elsewhere
|
||||
@ -65,25 +64,32 @@ void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseD
|
||||
if (i <2) {
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
|
||||
int runs = 2;
|
||||
for(int j = runs; j > 0; j--)
|
||||
{
|
||||
physics.takeUpdateStep(runTimeSinceLastUpdate/runs);
|
||||
if(i>=2)
|
||||
{
|
||||
mouseDelta.x = -mouseDelta.x;
|
||||
camera.updateRotation(mouseDelta/100.0f);
|
||||
physics.updateCameraPos(mouseDelta, 50, camera.getDistance());
|
||||
camera.updateRotation(mouseDelta/100.0f/(float)runs);
|
||||
physics.updateCameraPos(mouseDelta, 50/runs, camera.getDistance());
|
||||
|
||||
camera.setPosition(physics.getCameraPosition());
|
||||
camera.setDirection(physics.getCameraToPlayer());
|
||||
}
|
||||
if(wPressed){
|
||||
physics.rollForward(camera.getVector(),strength);
|
||||
physics.rollForward(camera.getVector(),strength/runs);
|
||||
}
|
||||
if(aPressed) {
|
||||
physics.rollLeft(camera.getVector(),strength);
|
||||
physics.rollLeft(camera.getVector(),strength/runs);
|
||||
}
|
||||
if(sPressed) {
|
||||
physics.rollBack(camera.getVector(),strength);
|
||||
physics.rollBack(camera.getVector(),strength/runs);
|
||||
}
|
||||
if(dPressed){
|
||||
physics.rollRight(camera.getVector(),strength);
|
||||
physics.rollRight(camera.getVector(),strength/runs);
|
||||
}
|
||||
}
|
||||
|
||||
if(kPressed)
|
||||
|
Loading…
Reference in New Issue
Block a user