disable mouse camera control if non-standard camera used

This commit is contained in:
MihailRis 2025-11-04 17:55:01 +03:00
parent 751489b003
commit 9e817c39ce
4 changed files with 15 additions and 5 deletions

View File

@ -49,8 +49,7 @@ LevelFrontend::LevelFrontend(
auto sound = rassets.get<audio::Sound>(material->stepsSound);
glm::vec3 pos {};
auto soundsCamera = currentPlayer->currentCamera.get();
if (soundsCamera == currentPlayer->spCamera.get() ||
soundsCamera == currentPlayer->tpCamera.get()) {
if (currentPlayer->isCurrentCameraBuiltin()) {
soundsCamera = currentPlayer->fpCamera.get();
}
bool relative = player == currentPlayer &&

View File

@ -207,8 +207,7 @@ void CameraControl::update(
tpCamera->front = camera->front;
tpCamera->right = camera->right;
}
if (player.currentCamera == spCamera || player.currentCamera == tpCamera ||
player.currentCamera == camera) {
if (player.isCurrentCameraBuiltin()) {
player.currentCamera->setFov(glm::radians(settings.fov.get()));
}
}
@ -280,7 +279,7 @@ void PlayerController::postUpdate(
updateFootsteps(delta);
}
if (!pause && input) {
if (!pause && input && player.isCurrentCameraBuiltin()) {
camControl.updateMouse(this->input, windowHeight);
}
camControl.refreshRotation();

View File

@ -84,6 +84,12 @@ Hitbox* Player::getHitbox() {
return nullptr;
}
bool Player::isCurrentCameraBuiltin() const {
return currentCamera.get() == fpCamera.get() ||
currentCamera.get() == spCamera.get() ||
currentCamera.get() == tpCamera.get();
}
void Player::updateSelectedEntity() {
selectedEid = selection.entity;
}

View File

@ -131,6 +131,8 @@ public:
return position;
}
bool isCurrentCameraBuiltin() const;
Hitbox* getHitbox();
void setSpawnPoint(glm::vec3 point);
@ -147,4 +149,8 @@ public:
inline u64id_t getId() const {
return id;
}
Level& getLevel() const {
return level;
}
};