diff --git a/Assets/Application.SHConfig b/Assets/Application.SHConfig index 61857f68..370665d2 100644 --- a/Assets/Application.SHConfig +++ b/Assets/Application.SHConfig @@ -1,4 +1,4 @@ Start in Fullscreen: false -Starting Scene ID: 97086054 +Starting Scene ID: 86098106 Window Size: {x: 1920, y: 1080} Window Title: SHADE Engine \ No newline at end of file diff --git a/Assets/CollisionTags.SHConfig b/Assets/CollisionTags.SHConfig index f29443f5..cea40d35 100644 --- a/Assets/CollisionTags.SHConfig +++ b/Assets/CollisionTags.SHConfig @@ -1,10 +1,10 @@ -0 1 3 +0 1 67 1 2 65535 2 3 65534 3 4 65534 4 5 65534 5 6 65534 -6 7 65534 +6 7 65535 7 8 65534 8 9 65534 9 10 65534 diff --git a/Assets/Editor/Editor.SHConfig b/Assets/Editor/Editor.SHConfig index 7a7c92f8..dc5101ee 100644 --- a/Assets/Editor/Editor.SHConfig +++ b/Assets/Editor/Editor.SHConfig @@ -1,4 +1,4 @@ Start Maximized: true -Working Scene ID: 97086054 +Working Scene ID: 87244611 Window Size: {x: 1920, y: 1013} Style: 0 \ No newline at end of file diff --git a/Assets/Editor/Layouts/UserLayout.ini b/Assets/Editor/Layouts/UserLayout.ini index 9a8687ca..769206d3 100644 --- a/Assets/Editor/Layouts/UserLayout.ini +++ b/Assets/Editor/Layouts/UserLayout.ini @@ -1,16 +1,16 @@ [Window][MainStatusBar] -Pos=0,989 +Pos=0,981 Size=1920,20 Collapsed=0 [Window][SHEditorMenuBar] Pos=0,48 -Size=1920,941 +Size=1920,933 Collapsed=0 [Window][Hierarchy Panel] -Pos=0,187 -Size=300,802 +Pos=0,186 +Size=300,795 Collapsed=0 DockId=0x00000004,0 @@ -21,13 +21,13 @@ Collapsed=0 [Window][Inspector] Pos=1434,48 -Size=486,941 +Size=486,933 Collapsed=0 DockId=0x00000006,0 [Window][Profiler] Pos=0,48 -Size=300,137 +Size=300,136 Collapsed=0 DockId=0x00000003,0 @@ -76,7 +76,7 @@ DockId=0x0000000B,0 [Window][ Viewport] Pos=302,48 -Size=1130,705 +Size=1130,697 Collapsed=0 DockId=0x0000000B,0 @@ -93,14 +93,14 @@ Collapsed=0 DockId=0x0000000A,0 [Window][ Asset Browser] -Pos=302,755 +Pos=302,747 Size=1130,234 Collapsed=0 DockId=0x0000000C,0 [Window][Material Inspector] Pos=1434,48 -Size=486,941 +Size=486,933 Collapsed=0 DockId=0x00000006,1 @@ -116,13 +116,13 @@ Collapsed=0 [Window][Collider Tag Panel] Pos=302,48 -Size=1130,705 +Size=1130,697 Collapsed=0 DockId=0x0000000B,1 [Window][Input Bindings Panel] Pos=1434,48 -Size=486,941 +Size=486,933 Collapsed=0 DockId=0x00000006,2 @@ -151,7 +151,7 @@ Column 15 Weight=1.2009 Column 16 Weight=1.0132 [Docking][Data] -DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=1920,941 Split=X +DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,77 Size=1920,933 Split=X DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=1432,1036 Split=X DockNode ID=0x00000001 Parent=0x00000005 SizeRef=300,1036 Split=Y Selected=0x1E6EB881 DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,147 Selected=0x1E6EB881 @@ -163,5 +163,5 @@ DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=1920,941 Split DockNode ID=0x0000000C Parent=0x00000009 SizeRef=1501,234 Selected=0xB128252A DockNode ID=0x0000000A Parent=0x00000007 SizeRef=1501,310 Selected=0xD446F7B6 DockNode ID=0x00000008 Parent=0x00000002 SizeRef=1501,338 Selected=0xD9F31532 - DockNode ID=0x00000006 Parent=0xC5C9B8AB SizeRef=486,1036 Selected=0xE7039252 + DockNode ID=0x00000006 Parent=0xC5C9B8AB SizeRef=486,1036 Selected=0xD3697FB6 diff --git a/Assets/Materials/UIMat.shmat b/Assets/Materials/UIMat.shmat index 625021b0..0ca4c7a1 100644 --- a/Assets/Materials/UIMat.shmat +++ b/Assets/Materials/UIMat.shmat @@ -1,6 +1,6 @@ - VertexShader: 46580970 FragmentShader: 35983630 - SubPass: G-Buffer Write + SubPass: UI Properties: data.color: {x: 1, y: 1, z: 1, w: 1} data.textureIndex: 54429632 diff --git a/Assets/Scenes/MainGame.shade b/Assets/Scenes/MainGame.shade index c55d16ca..116075d2 100644 --- a/Assets/Scenes/MainGame.shade +++ b/Assets/Scenes/MainGame.shade @@ -8486,7 +8486,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8533,7 +8533,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8580,7 +8580,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8627,7 +8627,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8674,7 +8674,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8721,7 +8721,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8768,7 +8768,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8815,7 +8815,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8862,7 +8862,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8909,7 +8909,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -8960,7 +8960,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9007,7 +9007,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9054,7 +9054,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9101,7 +9101,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9148,7 +9148,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9195,7 +9195,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9246,7 +9246,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9287,7 +9287,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9328,7 +9328,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9369,7 +9369,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9410,9 +9410,9 @@ Scale: {x: 1, y: 1, z: 1} IsActive: true RigidBody Component: - Type: Static + Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9449,9 +9449,9 @@ Scale: {x: 1, y: 1, z: 1} IsActive: true RigidBody Component: - Type: Static + Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9541,8 +9541,8 @@ NumberOfChildren: 3 Components: Transform Component: - Translate: {x: 2.12735963, y: 0.362327814, z: 6.98932981} - Rotate: {x: 0, y: 0, z: 0} + Translate: {x: 2.35245037, y: 0.38365531, z: 7.10571432} + Rotate: {x: -0, y: 0, z: -0} Scale: {x: 0.999999881, y: 1, z: 0.999999881} IsActive: true Renderable Component: @@ -9551,7 +9551,7 @@ IsActive: true RigidBody Component: Type: Dynamic - Drag: 1 + Drag: 0.00999999978 Angular Drag: 0.100000001 Use Gravity: false Interpolate: true @@ -9615,7 +9615,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 0, y: -2.98023224e-08, z: 4.76837158e-07} + Translate: {x: 0, y: -5.96046448e-08, z: 0} Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -9645,8 +9645,8 @@ turnSpeedPitch: 0.300000012 turnSpeedYaw: 0.5 pitchClamp: 45 - inverseXControls: true - inverseYControls: true + inverseXControls: false + inverseYControls: false - EID: 9 Name: PlayerBag IsActive: true @@ -9696,7 +9696,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9741,7 +9741,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9782,7 +9782,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9823,7 +9823,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9864,7 +9864,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9905,7 +9905,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9950,7 +9950,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -9991,7 +9991,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10032,7 +10032,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10073,7 +10073,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10114,7 +10114,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10159,7 +10159,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10200,7 +10200,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10241,7 +10241,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10282,7 +10282,7 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true Interpolate: true Sleeping Enabled: true @@ -10406,9 +10406,9 @@ RigidBody Component: Type: Dynamic Drag: 0.00999999978 - Angular Drag: 0.00999999978 + Angular Drag: 0.100000001 Use Gravity: true - Interpolate: false + Interpolate: true Sleeping Enabled: true Freeze Position X: false Freeze Position Y: false diff --git a/SHADE_Engine/src/Camera/SHCameraSystem.cpp b/SHADE_Engine/src/Camera/SHCameraSystem.cpp index 297e03b8..a6b04773 100644 --- a/SHADE_Engine/src/Camera/SHCameraSystem.cpp +++ b/SHADE_Engine/src/Camera/SHCameraSystem.cpp @@ -142,10 +142,10 @@ namespace SHADE - SHVec3 offset{ 0.0f,0.0f, pivot.GetArmLength() }; + SHVec3 offset{ 0.0f,0.0f, 1.0f }; offset = SHVec3::RotateX(offset, -(SHMath::DegreesToRadians(pivot.GetPitch()))); offset = SHVec3::RotateY(offset, (SHMath::DegreesToRadians(pivot.GetYaw()))); - + offset = SHVec3::Normalise(offset) * pivot.armLength; //pivot.rtMatrix = SHMatrix::RotateX(SHMath::DegreesToRadians(pivot.GetPitch())) // * SHMatrix::RotateY(SHMath::DegreesToRadians(pivot.GetYaw())) @@ -165,7 +165,7 @@ namespace SHADE return; - /*if (SHComponentManager::HasComponent(camera->GetEID()) == true && camera != &editorCamera) + if (SHComponentManager::HasComponent(camera->GetEID()) == true && camera != &editorCamera) { auto transform = SHComponentManager::GetComponent(camera->GetEID()); SHVec3 rotation = transform->GetWorldRotation(); @@ -174,14 +174,43 @@ namespace SHADE camera->roll = SHMath::RadiansToDegrees(rotation.z); camera->position = transform->GetWorldPosition(); camera->dirtyView = true; - }*/ - - pivot.ray.position = camera->GetPosition() + pivot.targetOffset; - pivot.ray.direction = SHVec3::Normalise((camera->position + offset)- pivot.ray.position); + } - //SHLOG_INFO("Ray position: {},{},{} direction:{},{},{}",pivot.ray.position.x, pivot.ray.position.y, pivot.ray.position.z,pivot.ray.direction.x, pivot.ray.direction.y, pivot.ray.direction.z) - //auto result = physicsSystem->Raycast(pivot.ray); + SHVec3 cameraPos = camera->position + pivot.offset; + SHVec3 cameraTarget = camera->position; + + //SHLOG_INFO("Ray position: {},{},{} direction:{},{},{}",pivot.ray.position.x, pivot.ray.position.y, pivot.ray.position.z,pivot.ray.direction.x, pivot.ray.direction.y, pivot.ray.direction.z) + SHRaycaster::RaycastInfo info; + //info.layers = (SHCollisionTagMatrix::GetTag("7")->GetMask()); + info.layers = (uint16_t)(SHCollisionTag::Layer::ALL); + info.distance = 1000000.0f; + info.continuous = true; + info.ray.position = cameraTarget; + info.SetColliderID(2); + info.ray.direction = SHVec3::Normalise(cameraPos - cameraTarget); + auto result = physicsSystem->Raycast(info); + for (auto hitResult : result) + { + if (hitResult.distance < pivot.armLength) + { + + SHVec3 newOffset{ 0.0f,0.0f, 1.0f }; + newOffset = SHVec3::RotateX(newOffset, -(SHMath::DegreesToRadians(pivot.GetPitch()))); + newOffset = SHVec3::RotateY(newOffset, (SHMath::DegreesToRadians(pivot.GetYaw()))); + newOffset = SHVec3::Normalise(newOffset) * (hitResult.distance); + pivot.offset = newOffset; + cameraPos = camera->position + pivot.offset; + SHLOG_INFO("CAMERA COLLISION HIT, {} armlength: {}, true armlength: {}", hitResult.distance, hitResult.distance, (cameraPos - camera->position).Length()); + break; + } + } + + + + + + ////auto result = physicsSystem->Raycast(pivot.ray); //if (result && result.distance < pivot.GetArmLength()) //{ // @@ -196,8 +225,6 @@ namespace SHADE // //SHLOG_INFO("CAMERA COLLISION CANT HIT CAMERA"); //} - // - // // pivot.rtMatrix = SHMatrix::Inverse(pivot.rtMatrix); @@ -234,7 +261,7 @@ namespace SHADE { camera.offset = arm->GetOffset(); if (arm->lookAtCameraOrigin) - CameraLookAt(camera, camera.position + arm->GetTargetOffset()); + CameraLookAt(camera, camera.position); } } diff --git a/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h b/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h index 995a1cf5..280dee88 100644 --- a/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h +++ b/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h @@ -94,7 +94,7 @@ namespace SHADE if (systemContainer.find(id) == systemContainer.end()) { - std::cout << "System Manager error: System Version " << version << " does not exit." << std::endl; + std::cout << "System Manager error: System Version "<< typeid(T).name()<<" " << version << " does not exist." << std::endl; return nullptr; }