Added a DegreesToRadians when setting rotation of camera comp

This commit is contained in:
maverickdgg 2022-10-25 17:30:11 +08:00
parent aa1b45c3de
commit 53fc0c970c
2 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@
#include "SHCameraSystem.h"
#include "ECS_Base/Managers/SHSystemManager.h"
#include "Math/Transform/SHTransformComponent.h"
#include "Math/SHMath.h"
namespace SHADE
{
@ -28,7 +29,7 @@ namespace SHADE
{
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(GetEID());
SHVec3 rotation = transform->GetWorldRotation();
transform->SetWorldRotation(SHVec3{rotation.x,yaw, rotation.z});
transform->SetWorldRotation(SHVec3{rotation.x,SHMath::DegreesToRadians(yaw), rotation.z});
}
dirtyView = true;
}
@ -40,7 +41,7 @@ namespace SHADE
{
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(GetEID());
SHVec3 rotation = transform->GetWorldRotation();
transform->SetWorldRotation(SHVec3{ pitch,rotation.y, rotation.z });
transform->SetWorldRotation(SHVec3{ SHMath::DegreesToRadians(pitch),rotation.y, rotation.z });
}
dirtyView = true;
}
@ -52,7 +53,7 @@ namespace SHADE
{
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(GetEID());
SHVec3 rotation = transform->GetWorldRotation();
transform->SetWorldRotation(SHVec3{ rotation.x,rotation.y, roll});
transform->SetWorldRotation(SHVec3{ rotation.x,rotation.y, SHMath::DegreesToRadians(roll)});
}
dirtyView = true;
}

View File

@ -69,7 +69,7 @@ namespace SHADE
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::A))
{
std::cout << "Camera movement: "<<right.x<<", " << right.y << std::endl;
//std::cout << "Camera movement: "<<right.x<<", " << right.y << std::endl;
camera.position -= right * dt * camera.movementSpeed;
camera.dirtyView = true;
}
@ -110,7 +110,7 @@ namespace SHADE
camera.dirtyView = true;
}
std::cout << "Camera position: " << camera.position.x << " " << camera.position.y << std::endl;
//std::cout << "Camera position: " << camera.position.x << " " << camera.position.y << std::endl;
system->UpdateCameraComponent(system->editorCamera);
}