Reworked collision detection so it doesn't break if the mouse moves too fast and cleaning items don't sproadically shake when collision gets funky

This commit is contained in:
Gregory Campbell
2020-06-05 14:49:25 -04:00
parent b51124c1b4
commit fd0aa415da
5 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ BoxCollider2D:
m_Enabled: 1 m_Enabled: 1
m_Density: 1 m_Density: 1
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 1
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
+1 -1
View File
@@ -106,7 +106,7 @@ BoxCollider2D:
m_Enabled: 1 m_Enabled: 1
m_Density: 1 m_Density: 1
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 1
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
+6 -6
View File
@@ -423,8 +423,8 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1739945071} - component: {fileID: 1739945071}
- component: {fileID: 1739945070} - component: {fileID: 1739945070}
- component: {fileID: 1739945073}
- component: {fileID: 1739945072} - component: {fileID: 1739945072}
- component: {fileID: 1739945073}
m_Layer: 0 m_Layer: 0
m_Name: SprayBottle m_Name: SprayBottle
m_TagString: Item m_TagString: Item
@@ -593,7 +593,7 @@ Rigidbody2D:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1739945069} m_GameObject: {fileID: 1739945069}
m_BodyType: 0 m_BodyType: 1
m_Simulated: 1 m_Simulated: 1
m_UseFullKinematicContacts: 0 m_UseFullKinematicContacts: 0
m_UseAutoMass: 0 m_UseAutoMass: 0
@@ -604,7 +604,7 @@ Rigidbody2D:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Interpolate: 0 m_Interpolate: 0
m_SleepingMode: 1 m_SleepingMode: 1
m_CollisionDetection: 0 m_CollisionDetection: 1
m_Constraints: 0 m_Constraints: 0
--- !u!1 &1885377150 --- !u!1 &1885377150
GameObject: GameObject:
@@ -616,8 +616,8 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1885377152} - component: {fileID: 1885377152}
- component: {fileID: 1885377151} - component: {fileID: 1885377151}
- component: {fileID: 1885377154}
- component: {fileID: 1885377153} - component: {fileID: 1885377153}
- component: {fileID: 1885377154}
m_Layer: 0 m_Layer: 0
m_Name: Rag m_Name: Rag
m_TagString: Item m_TagString: Item
@@ -810,7 +810,7 @@ Rigidbody2D:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1885377150} m_GameObject: {fileID: 1885377150}
m_BodyType: 0 m_BodyType: 1
m_Simulated: 1 m_Simulated: 1
m_UseFullKinematicContacts: 0 m_UseFullKinematicContacts: 0
m_UseAutoMass: 0 m_UseAutoMass: 0
@@ -821,5 +821,5 @@ Rigidbody2D:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Interpolate: 0 m_Interpolate: 0
m_SleepingMode: 1 m_SleepingMode: 1
m_CollisionDetection: 0 m_CollisionDetection: 1
m_Constraints: 0 m_Constraints: 0
+2 -2
View File
@@ -10,7 +10,7 @@ public class DirtScript : MonoBehaviour
private int wiped = 0; private int wiped = 0;
Color tmp; Color tmp;
void OnCollisionEnter2D(Collision2D other){ void OnTriggerEnter2D(Collider2D other){
if(other.gameObject.name == "SprayBottle" && !sprayed) if(other.gameObject.name == "SprayBottle" && !sprayed)
{ {
@@ -20,7 +20,7 @@ public class DirtScript : MonoBehaviour
} }
void OnCollisionExit2D(Collision2D other){ void OnTriggerExit2D(Collider2D other){
tmp = this.GetComponent<SpriteRenderer>().color; tmp = this.GetComponent<SpriteRenderer>().color;
+1 -1
View File
@@ -8,7 +8,7 @@ public class SprayScript : MonoBehaviour
private int wiped = 0; private int wiped = 0;
Color tmp; Color tmp;
void OnCollisionExit2D(Collision2D other){ void OnTriggerExit2D(Collider2D other){
tmp = this.GetComponent<SpriteRenderer>().color; tmp = this.GetComponent<SpriteRenderer>().color;