diff options
-rw-r--r-- | marching/Assets/Scenes/Test.unity | 46 | ||||
-rw-r--r-- | marching/Assets/Scripts/Physics/PhysicsManager_CollisionDetection.cs | 6 |
2 files changed, 6 insertions, 46 deletions
diff --git a/marching/Assets/Scenes/Test.unity b/marching/Assets/Scenes/Test.unity index abdb71c..6474326 100644 --- a/marching/Assets/Scenes/Test.unity +++ b/marching/Assets/Scenes/Test.unity @@ -11139,52 +11139,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 14 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1731899510 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1731899512} - - component: {fileID: 1731899511} - m_Layer: 0 - m_Name: GameObject - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1731899511 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1731899510} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4ddedc9aac270da4eb59670351403718, type: 3} - m_Name: - m_EditorClassIdentifier: - ray: {x: 0, y: 0, z: 1, w: 1} - size: {x: 1, y: 1} ---- !u!4 &1731899512 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1731899510} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.849, y: 0.33, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 68 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1738161037 GameObject: m_ObjectHideFlags: 0 diff --git a/marching/Assets/Scripts/Physics/PhysicsManager_CollisionDetection.cs b/marching/Assets/Scripts/Physics/PhysicsManager_CollisionDetection.cs index 5210767..22c2f4e 100644 --- a/marching/Assets/Scripts/Physics/PhysicsManager_CollisionDetection.cs +++ b/marching/Assets/Scripts/Physics/PhysicsManager_CollisionDetection.cs @@ -147,8 +147,14 @@ public partial class PhysicsManager : Singleton<PhysicsManager> } } + // Does the ray start inside the box? + // Does the ray intersect beyond the max fraction? if (tmin < 0 || ray.zw().magnitude < tmin) + { + if (IsPointInsideBox(box, p)) + return true; return false; + } //// Intersection. //output->fraction = tmin; //output->normal = normal; |