WIP collision

This commit is contained in:
maverickdgg 2023-02-04 00:17:29 +08:00
parent 7818c6f2d2
commit c88ce23d45
8 changed files with 105 additions and 78 deletions

View File

@ -1,4 +1,4 @@
Start in Fullscreen: false Start in Fullscreen: false
Starting Scene ID: 97086054 Starting Scene ID: 86098106
Window Size: {x: 1920, y: 1080} Window Size: {x: 1920, y: 1080}
Window Title: SHADE Engine Window Title: SHADE Engine

View File

@ -1,10 +1,10 @@
0 1 3 0 1 67
1 2 65535 1 2 65535
2 3 65534 2 3 65534
3 4 65534 3 4 65534
4 5 65534 4 5 65534
5 6 65534 5 6 65534
6 7 65534 6 7 65535
7 8 65534 7 8 65534
8 9 65534 8 9 65534
9 10 65534 9 10 65534

View File

@ -1,4 +1,4 @@
Start Maximized: true Start Maximized: true
Working Scene ID: 97086054 Working Scene ID: 87244611
Window Size: {x: 1920, y: 1013} Window Size: {x: 1920, y: 1013}
Style: 0 Style: 0

View File

@ -1,16 +1,16 @@
[Window][MainStatusBar] [Window][MainStatusBar]
Pos=0,989 Pos=0,981
Size=1920,20 Size=1920,20
Collapsed=0 Collapsed=0
[Window][SHEditorMenuBar] [Window][SHEditorMenuBar]
Pos=0,48 Pos=0,48
Size=1920,941 Size=1920,933
Collapsed=0 Collapsed=0
[Window][Hierarchy Panel] [Window][Hierarchy Panel]
Pos=0,187 Pos=0,186
Size=300,802 Size=300,795
Collapsed=0 Collapsed=0
DockId=0x00000004,0 DockId=0x00000004,0
@ -21,13 +21,13 @@ Collapsed=0
[Window][Inspector] [Window][Inspector]
Pos=1434,48 Pos=1434,48
Size=486,941 Size=486,933
Collapsed=0 Collapsed=0
DockId=0x00000006,0 DockId=0x00000006,0
[Window][Profiler] [Window][Profiler]
Pos=0,48 Pos=0,48
Size=300,137 Size=300,136
Collapsed=0 Collapsed=0
DockId=0x00000003,0 DockId=0x00000003,0
@ -76,7 +76,7 @@ DockId=0x0000000B,0
[Window][ Viewport] [Window][ Viewport]
Pos=302,48 Pos=302,48
Size=1130,705 Size=1130,697
Collapsed=0 Collapsed=0
DockId=0x0000000B,0 DockId=0x0000000B,0
@ -93,14 +93,14 @@ Collapsed=0
DockId=0x0000000A,0 DockId=0x0000000A,0
[Window][ Asset Browser] [Window][ Asset Browser]
Pos=302,755 Pos=302,747
Size=1130,234 Size=1130,234
Collapsed=0 Collapsed=0
DockId=0x0000000C,0 DockId=0x0000000C,0
[Window][Material Inspector] [Window][Material Inspector]
Pos=1434,48 Pos=1434,48
Size=486,941 Size=486,933
Collapsed=0 Collapsed=0
DockId=0x00000006,1 DockId=0x00000006,1
@ -116,13 +116,13 @@ Collapsed=0
[Window][Collider Tag Panel] [Window][Collider Tag Panel]
Pos=302,48 Pos=302,48
Size=1130,705 Size=1130,697
Collapsed=0 Collapsed=0
DockId=0x0000000B,1 DockId=0x0000000B,1
[Window][Input Bindings Panel] [Window][Input Bindings Panel]
Pos=1434,48 Pos=1434,48
Size=486,941 Size=486,933
Collapsed=0 Collapsed=0
DockId=0x00000006,2 DockId=0x00000006,2
@ -151,7 +151,7 @@ Column 15 Weight=1.2009
Column 16 Weight=1.0132 Column 16 Weight=1.0132
[Docking][Data] [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=0x00000005 Parent=0xC5C9B8AB SizeRef=1432,1036 Split=X
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=300,1036 Split=Y Selected=0x1E6EB881 DockNode ID=0x00000001 Parent=0x00000005 SizeRef=300,1036 Split=Y Selected=0x1E6EB881
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,147 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=0x0000000C Parent=0x00000009 SizeRef=1501,234 Selected=0xB128252A
DockNode ID=0x0000000A Parent=0x00000007 SizeRef=1501,310 Selected=0xD446F7B6 DockNode ID=0x0000000A Parent=0x00000007 SizeRef=1501,310 Selected=0xD446F7B6
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=1501,338 Selected=0xD9F31532 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

View File

@ -1,6 +1,6 @@
- VertexShader: 46580970 - VertexShader: 46580970
FragmentShader: 35983630 FragmentShader: 35983630
SubPass: G-Buffer Write SubPass: UI
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54429632 data.textureIndex: 54429632

View File

@ -8486,7 +8486,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8533,7 +8533,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8580,7 +8580,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8627,7 +8627,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8674,7 +8674,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8721,7 +8721,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8768,7 +8768,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8815,7 +8815,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8862,7 +8862,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8909,7 +8909,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -8960,7 +8960,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9007,7 +9007,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9054,7 +9054,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9101,7 +9101,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9148,7 +9148,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9195,7 +9195,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9246,7 +9246,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9287,7 +9287,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9328,7 +9328,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9369,7 +9369,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9410,9 +9410,9 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9449,9 +9449,9 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9541,8 +9541,8 @@
NumberOfChildren: 3 NumberOfChildren: 3
Components: Components:
Transform Component: Transform Component:
Translate: {x: 2.12735963, y: 0.362327814, z: 6.98932981} Translate: {x: 2.35245037, y: 0.38365531, z: 7.10571432}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 0.999999881, y: 1, z: 0.999999881} Scale: {x: 0.999999881, y: 1, z: 0.999999881}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
@ -9551,7 +9551,7 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 1 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Use Gravity: false Use Gravity: false
Interpolate: true Interpolate: true
@ -9615,7 +9615,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: 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} Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
@ -9645,8 +9645,8 @@
turnSpeedPitch: 0.300000012 turnSpeedPitch: 0.300000012
turnSpeedYaw: 0.5 turnSpeedYaw: 0.5
pitchClamp: 45 pitchClamp: 45
inverseXControls: true inverseXControls: false
inverseYControls: true inverseYControls: false
- EID: 9 - EID: 9
Name: PlayerBag Name: PlayerBag
IsActive: true IsActive: true
@ -9696,7 +9696,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9741,7 +9741,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9782,7 +9782,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9823,7 +9823,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9864,7 +9864,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9905,7 +9905,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9950,7 +9950,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -9991,7 +9991,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10032,7 +10032,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10073,7 +10073,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10114,7 +10114,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10159,7 +10159,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10200,7 +10200,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10241,7 +10241,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10282,7 +10282,7 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
@ -10406,9 +10406,9 @@
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false

View File

@ -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::RotateX(offset, -(SHMath::DegreesToRadians(pivot.GetPitch())));
offset = SHVec3::RotateY(offset, (SHMath::DegreesToRadians(pivot.GetYaw()))); offset = SHVec3::RotateY(offset, (SHMath::DegreesToRadians(pivot.GetYaw())));
offset = SHVec3::Normalise(offset) * pivot.armLength;
//pivot.rtMatrix = SHMatrix::RotateX(SHMath::DegreesToRadians(pivot.GetPitch())) //pivot.rtMatrix = SHMatrix::RotateX(SHMath::DegreesToRadians(pivot.GetPitch()))
// * SHMatrix::RotateY(SHMath::DegreesToRadians(pivot.GetYaw())) // * SHMatrix::RotateY(SHMath::DegreesToRadians(pivot.GetYaw()))
@ -165,7 +165,7 @@ namespace SHADE
return; return;
/*if (SHComponentManager::HasComponent<SHTransformComponent>(camera->GetEID()) == true && camera != &editorCamera) if (SHComponentManager::HasComponent<SHTransformComponent>(camera->GetEID()) == true && camera != &editorCamera)
{ {
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera->GetEID()); auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera->GetEID());
SHVec3 rotation = transform->GetWorldRotation(); SHVec3 rotation = transform->GetWorldRotation();
@ -174,14 +174,43 @@ namespace SHADE
camera->roll = SHMath::RadiansToDegrees(rotation.z); camera->roll = SHMath::RadiansToDegrees(rotation.z);
camera->position = transform->GetWorldPosition(); camera->position = transform->GetWorldPosition();
camera->dirtyView = true; camera->dirtyView = true;
}*/ }
pivot.ray.position = camera->GetPosition() + pivot.targetOffset;
pivot.ray.direction = SHVec3::Normalise((camera->position + offset)- pivot.ray.position); 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) //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)
{
//auto result = physicsSystem->Raycast(pivot.ray); 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()) //if (result && result.distance < pivot.GetArmLength())
//{ //{
// //
@ -196,8 +225,6 @@ namespace SHADE
// //SHLOG_INFO("CAMERA COLLISION CANT HIT CAMERA"); // //SHLOG_INFO("CAMERA COLLISION CANT HIT CAMERA");
//} //}
//
//
// pivot.rtMatrix = SHMatrix::Inverse(pivot.rtMatrix); // pivot.rtMatrix = SHMatrix::Inverse(pivot.rtMatrix);
@ -234,7 +261,7 @@ namespace SHADE
{ {
camera.offset = arm->GetOffset(); camera.offset = arm->GetOffset();
if (arm->lookAtCameraOrigin) if (arm->lookAtCameraOrigin)
CameraLookAt(camera, camera.position + arm->GetTargetOffset()); CameraLookAt(camera, camera.position);
} }
} }

View File

@ -94,7 +94,7 @@ namespace SHADE
if (systemContainer.find(id) == systemContainer.end()) 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; return nullptr;
} }