Fixed editor camera

This commit is contained in:
maverickdgg 2022-10-23 15:03:24 +08:00
parent 96a7896da9
commit aa1b45c3de
1 changed files with 5 additions and 3 deletions

View File

@ -69,6 +69,7 @@ namespace SHADE
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::A))
{
std::cout << "Camera movement: "<<right.x<<", " << right.y << std::endl;
camera.position -= right * dt * camera.movementSpeed;
camera.dirtyView = true;
}
@ -109,6 +110,7 @@ namespace SHADE
camera.dirtyView = true;
}
std::cout << "Camera position: " << camera.position.x << " " << camera.position.y << std::endl;
system->UpdateCameraComponent(system->editorCamera);
}
@ -134,7 +136,7 @@ namespace SHADE
void SHCameraSystem::UpdateCameraComponent(SHCameraComponent& camera) noexcept
{
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true)
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && &camera != &editorCamera)
{
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID());
SHVec3 rotation = transform->GetWorldRotation();
@ -151,7 +153,7 @@ namespace SHADE
SHVec3 view, right, UP;
ClampCameraRotation(camera);
//ClampCameraRotation(camera);
GetCameraAxis(camera, view, right, UP);