Fix for tetrominoes falling partway through the floor.
This commit is contained in:
parent
184524db56
commit
feda7a1a8a
5 changed files with 63 additions and 64 deletions
|
@ -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,11 +84,9 @@ public class tetromino : MonoBehaviour
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Fall()
|
||||
{
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"dependencies": {}
|
||||
},
|
||||
"com.unity.collab-proxy": {
|
||||
"version": "1.9.0",
|
||||
"version": "1.11.2",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--- !u!19 &1
|
||||
Physics2DSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 4
|
||||
serializedVersion: 5
|
||||
m_Gravity: {x: 0, y: -9.81}
|
||||
m_DefaultMaterial: {fileID: 0}
|
||||
m_VelocityIterations: 8
|
||||
|
@ -38,9 +38,9 @@ Physics2DSettings:
|
|||
m_IslandSolverJointCostScale: 10
|
||||
m_IslandSolverBodiesPerJob: 50
|
||||
m_IslandSolverContactsPerJob: 50
|
||||
m_AutoSimulation: 1
|
||||
m_SimulationMode: 0
|
||||
m_QueriesHitTriggers: 1
|
||||
m_QueriesStartInColliders: 1
|
||||
m_QueriesStartInColliders: 0
|
||||
m_CallbacksOnDisable: 1
|
||||
m_ReuseCollisionCallbacks: 1
|
||||
m_AutoSyncTransforms: 0
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue