mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
remove camera latency
This commit is contained in:
parent
8bb736bef0
commit
af1b32d91d
5 changed files with 59 additions and 51 deletions
|
|
@ -163,6 +163,8 @@ void CameraControl::update(const PlayerInput& input, float delta, Chunks* chunks
|
|||
auto spCamera = player->spCamera;
|
||||
auto tpCamera = player->tpCamera;
|
||||
|
||||
refresh();
|
||||
|
||||
if (player->currentCamera == spCamera) {
|
||||
spCamera->position = chunks->rayCastToObstacle(
|
||||
camera->position, camera->front, 3.0f) - 0.2f * camera->front;
|
||||
|
|
@ -256,16 +258,17 @@ void PlayerController::postUpdate(float delta, bool input, bool pause) {
|
|||
if (!pause) {
|
||||
updateFootsteps(delta);
|
||||
}
|
||||
player->postUpdate();
|
||||
camControl.refresh();
|
||||
if (!pause) {
|
||||
updateCamera(delta, input);
|
||||
|
||||
if (!pause && input) {
|
||||
camControl.updateMouse(this->input);
|
||||
}
|
||||
if (input) {
|
||||
updateInteraction();
|
||||
} else {
|
||||
player->selection = {};
|
||||
}
|
||||
player->postUpdate();
|
||||
camControl.update(this->input, delta, level->chunks.get());
|
||||
}
|
||||
|
||||
void PlayerController::updateKeyboard() {
|
||||
|
|
@ -283,13 +286,6 @@ void PlayerController::updateKeyboard() {
|
|||
input.flight = Events::jactive(BIND_PLAYER_FLIGHT);
|
||||
}
|
||||
|
||||
void PlayerController::updateCamera(float delta, bool movement) {
|
||||
if (movement) {
|
||||
camControl.updateMouse(input);
|
||||
}
|
||||
camControl.update(input, delta, level->chunks.get());
|
||||
}
|
||||
|
||||
void PlayerController::resetKeyboard() {
|
||||
input.zoom = false;
|
||||
input.moveForward = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue