Fixed Camera Collision #417

Merged
maverickdgg merged 1 commits from SP3-141-Camera-System into main 2023-03-10 19:00:32 +08:00
1 changed files with 13 additions and 3 deletions
Showing only changes of commit 6be5895ec7 - Show all commits

View File

@ -206,6 +206,16 @@ namespace SHADE
camera->dirtyView = true;
}
camera->offset = offset;
SHVec3 tOffset = pivot.GetTargetOffset();
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(pivot.GetYaw()));
if (pivot.lookAtCameraOrigin)
CameraLookAt(*camera, camera->position + pivot.GetTargetOffset());
@ -250,7 +260,7 @@ namespace SHADE
if (camera.isActive == false)
return;
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && &camera != &editorCamera)
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && SHComponentManager::HasComponent<SHCameraArmComponent>(camera.GetEID()) == false && &camera != &editorCamera)
{
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID());
SHVec3 rotation = transform->GetWorldRotation();
@ -273,14 +283,14 @@ namespace SHADE
{
camera.offset = arm->GetOffset();
SHVec3 tOffset = arm->GetTargetOffset();
/*SHVec3 tOffset = arm->GetTargetOffset();
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw()));
if (arm->lookAtCameraOrigin)
CameraLookAt(camera, camera.position + tOffset);
CameraLookAt(camera, camera.position + arm->GetTargetOffset());*/
}