Solved jittering by moving physics update in the level update.
This commit is contained in:
parent
2d65071887
commit
abeab11875
4
level.cc
4
level.cc
@ -57,6 +57,8 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) {
|
void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) {
|
||||||
|
physics.takeUpdateStep(runTime);
|
||||||
|
|
||||||
// Ignore first two mouse updates, because they are incorrect
|
// Ignore first two mouse updates, because they are incorrect
|
||||||
// DON'T try to move this functionallity elsewhere
|
// DON'T try to move this functionallity elsewhere
|
||||||
static int i = 0;
|
static int i = 0;
|
||||||
@ -89,8 +91,6 @@ void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPre
|
|||||||
if(lPressed)
|
if(lPressed)
|
||||||
camera.setIsPhysicsCamera(false);
|
camera.setIsPhysicsCamera(false);
|
||||||
|
|
||||||
physics.takeUpdateStep(runTime);
|
|
||||||
|
|
||||||
cameraCenter->setPosition(physics.getPos(0));
|
cameraCenter->setPosition(physics.getPos(0));
|
||||||
cameraCenter->setRotation(physics.getRotation(0));
|
cameraCenter->setRotation(physics.getRotation(0));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user