From feda7a1a8ac6f52d1e1d8c01db7aaed16d9c67f9 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Fri, 8 Oct 2021 20:58:19 -0600 Subject: [PATCH] Fix for tetrominoes falling partway through the floor. --- Assets/Scripts/tetromino.cs | 7 +- Packages/manifest.json | 2 +- Packages/packages-lock.json | 2 +- ProjectSettings/Physics2DSettings.asset | 112 ++++++++++++------------ ProjectSettings/ProjectVersion.txt | 4 +- 5 files changed, 63 insertions(+), 64 deletions(-) diff --git a/Assets/Scripts/tetromino.cs b/Assets/Scripts/tetromino.cs index 5942434..a4b3e12 100644 --- a/Assets/Scripts/tetromino.cs +++ b/Assets/Scripts/tetromino.cs @@ -70,6 +70,7 @@ public class tetromino : MonoBehaviour private bool validateFall(Transform pieceToCheck) //returns true if the next step collides with something { //Cast a ray to the next position of the tetromino. + //NOTE: disabled "Queries Start in Colliders" in Project Settings>Physics 2D (thank you again, Tavi). RaycastHit2D collision = Physics2D.Raycast(pieceToCheck.position, Vector2.down, 1.0f); Debug.DrawRay(pieceToCheck.position,Vector3.down,Color.red,1000.0f); if (collision.collider != null && collision.collider.name != pieceToCheck.name) @@ -83,10 +84,8 @@ public class tetromino : MonoBehaviour } return true; } - else - { - return false; - } + + return false; } void Fall() diff --git a/Packages/manifest.json b/Packages/manifest.json index bcfb296..eda0806 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -6,7 +6,7 @@ "com.unity.2d.sprite": "1.0.0", "com.unity.2d.spriteshape": "6.0.1", "com.unity.2d.tilemap": "1.0.0", - "com.unity.collab-proxy": "1.9.0", + "com.unity.collab-proxy": "1.11.2", "com.unity.ide.rider": "3.0.7", "com.unity.ide.visualstudio": "2.0.11", "com.unity.ide.vscode": "1.2.4", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 80470e1..82b0348 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -73,7 +73,7 @@ "dependencies": {} }, "com.unity.collab-proxy": { - "version": "1.9.0", + "version": "1.11.2", "depth": 0, "source": "registry", "dependencies": {}, diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset index 1a546aa..a702482 100644 --- a/ProjectSettings/Physics2DSettings.asset +++ b/ProjectSettings/Physics2DSettings.asset @@ -1,56 +1,56 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!19 &1 -Physics2DSettings: - m_ObjectHideFlags: 0 - serializedVersion: 4 - m_Gravity: {x: 0, y: -9.81} - m_DefaultMaterial: {fileID: 0} - m_VelocityIterations: 8 - m_PositionIterations: 3 - m_VelocityThreshold: 1 - m_MaxLinearCorrection: 0.2 - m_MaxAngularCorrection: 8 - m_MaxTranslationSpeed: 100 - m_MaxRotationSpeed: 360 - m_BaumgarteScale: 0.2 - m_BaumgarteTimeOfImpactScale: 0.75 - m_TimeToSleep: 0.5 - m_LinearSleepTolerance: 0.01 - m_AngularSleepTolerance: 2 - m_DefaultContactOffset: 0.01 - m_JobOptions: - serializedVersion: 2 - useMultithreading: 0 - useConsistencySorting: 0 - m_InterpolationPosesPerJob: 100 - m_NewContactsPerJob: 30 - m_CollideContactsPerJob: 100 - m_ClearFlagsPerJob: 200 - m_ClearBodyForcesPerJob: 200 - m_SyncDiscreteFixturesPerJob: 50 - m_SyncContinuousFixturesPerJob: 50 - m_FindNearestContactsPerJob: 100 - m_UpdateTriggerContactsPerJob: 100 - m_IslandSolverCostThreshold: 100 - m_IslandSolverBodyCostScale: 1 - m_IslandSolverContactCostScale: 10 - m_IslandSolverJointCostScale: 10 - m_IslandSolverBodiesPerJob: 50 - m_IslandSolverContactsPerJob: 50 - m_AutoSimulation: 1 - m_QueriesHitTriggers: 1 - m_QueriesStartInColliders: 1 - m_CallbacksOnDisable: 1 - m_ReuseCollisionCallbacks: 1 - m_AutoSyncTransforms: 0 - m_AlwaysShowColliders: 0 - m_ShowColliderSleep: 1 - m_ShowColliderContacts: 0 - m_ShowColliderAABB: 0 - m_ContactArrowScale: 0.2 - m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} - m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} - m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} - m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} - m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!19 &1 +Physics2DSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_Gravity: {x: 0, y: -9.81} + m_DefaultMaterial: {fileID: 0} + m_VelocityIterations: 8 + m_PositionIterations: 3 + m_VelocityThreshold: 1 + m_MaxLinearCorrection: 0.2 + m_MaxAngularCorrection: 8 + m_MaxTranslationSpeed: 100 + m_MaxRotationSpeed: 360 + m_BaumgarteScale: 0.2 + m_BaumgarteTimeOfImpactScale: 0.75 + m_TimeToSleep: 0.5 + m_LinearSleepTolerance: 0.01 + m_AngularSleepTolerance: 2 + m_DefaultContactOffset: 0.01 + m_JobOptions: + serializedVersion: 2 + useMultithreading: 0 + useConsistencySorting: 0 + m_InterpolationPosesPerJob: 100 + m_NewContactsPerJob: 30 + m_CollideContactsPerJob: 100 + m_ClearFlagsPerJob: 200 + m_ClearBodyForcesPerJob: 200 + m_SyncDiscreteFixturesPerJob: 50 + m_SyncContinuousFixturesPerJob: 50 + m_FindNearestContactsPerJob: 100 + m_UpdateTriggerContactsPerJob: 100 + m_IslandSolverCostThreshold: 100 + m_IslandSolverBodyCostScale: 1 + m_IslandSolverContactCostScale: 10 + m_IslandSolverJointCostScale: 10 + m_IslandSolverBodiesPerJob: 50 + m_IslandSolverContactsPerJob: 50 + m_SimulationMode: 0 + m_QueriesHitTriggers: 1 + m_QueriesStartInColliders: 0 + m_CallbacksOnDisable: 1 + m_ReuseCollisionCallbacks: 1 + m_AutoSyncTransforms: 0 + m_AlwaysShowColliders: 0 + m_ShowColliderSleep: 1 + m_ShowColliderContacts: 0 + m_ShowColliderAABB: 0 + m_ContactArrowScale: 0.2 + m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} + m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} + m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} + m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index fe1188f..5c25ebf 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2021.1.22f1 -m_EditorVersionWithRevision: 2021.1.22f1 (a137e5fb0427) +m_EditorVersion: 2021.1.24f1 +m_EditorVersionWithRevision: 2021.1.24f1 (6667702a1e7c)