From 4ed7aa3aed2ccfcf0eb6742bd5dc5b041765aced Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Mon, 23 Jan 2023 03:03:40 +0800 Subject: [PATCH] Reverted an attempt to stabilise edge detection between polyhedrons --- Assets/Scenes/PhysicsSandbox.shade | 8 ++++---- .../Physics/Collision/Narrowphase/SHConvexVsConvex.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scenes/PhysicsSandbox.shade b/Assets/Scenes/PhysicsSandbox.shade index 3b940bc1..56f272e0 100644 --- a/Assets/Scenes/PhysicsSandbox.shade +++ b/Assets/Scenes/PhysicsSandbox.shade @@ -45,7 +45,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 0, y: 7.5, z: 0} + Translate: {x: 2, y: 7.5, z: 0} Rotate: {x: -0, y: 0, z: 0.785398185} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -60,7 +60,7 @@ Interpolate: true Sleeping Enabled: true Freeze Position X: false - Freeze Position Y: false + Freeze Position Y: true Freeze Position Z: false Freeze Rotation X: false Freeze Rotation Y: false @@ -182,8 +182,8 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 0, y: 2, z: 3} - Rotate: {x: 0, y: 0.785398185, z: 0} + Translate: {x: 0, y: 7, z: 0} + Rotate: {x: 0, y: 0, z: 0.785398185} Scale: {x: 0.999990404, y: 0.999994457, z: 0.999985337} IsActive: true RigidBody Component: diff --git a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp index f2d6fcb3..e38a66a7 100644 --- a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp +++ b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp @@ -364,7 +364,7 @@ namespace SHADE const float DENOMINATOR = AV_DOT_VB - AV_DOT_VA * A2_OVER_A1; // We clamp it because the factor cannot be beyond [0,1] as it would be beyond the segment if it was so. - const float R = std::clamp(NUMERATOR / DENOMINATOR, 0.0f, 1.0f); + const float R = DENOMINATOR == 0.0f ? NUMERATOR : NUMERATOR / DENOMINATOR; // Just take a point from A since it's A -> B return TAIL_A + R * VA;