Cooker collision

This commit is contained in:
2024-03-06 09:12:00 +01:00
parent e4e75988d2
commit 24948de762
3 changed files with 66 additions and 8 deletions

View File

@@ -251,7 +251,7 @@ BoxCollider2D:
m_CallbackLayers: m_CallbackLayers:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_IsTrigger: 1 m_IsTrigger: 0
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
@@ -383,7 +383,7 @@ SpriteRenderer:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1147379266} m_GameObject: {fileID: 1147379266}
m_Enabled: 1 m_Enabled: 0
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
@@ -454,6 +454,8 @@ GameObject:
- component: {fileID: 1517788315} - component: {fileID: 1517788315}
- component: {fileID: 1517788314} - component: {fileID: 1517788314}
- component: {fileID: 1517788313} - component: {fileID: 1517788313}
- component: {fileID: 1517788316}
- component: {fileID: 1517788317}
m_Layer: 0 m_Layer: 0
m_Name: Cooker m_Name: Cooker
m_TagString: Untagged m_TagString: Untagged
@@ -490,7 +492,7 @@ BoxCollider2D:
m_CallbackLayers: m_CallbackLayers:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_IsTrigger: 1 m_IsTrigger: 0
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
@@ -513,7 +515,7 @@ SpriteRenderer:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1517788312} m_GameObject: {fileID: 1517788312}
m_Enabled: 0 m_Enabled: 1
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
@@ -573,6 +575,45 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1517788316
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1517788312}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84e0c3f7dac20fb428c544f192588d80, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!50 &1517788317
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1517788312}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 7
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -8,11 +8,26 @@ public class Cooking : MonoBehaviour
void GetIngredients() void GetIngredients()
{ {
// foreach (GameObject ingredient in currentCollisions) {
// Debug.Log(ingredient.name);
// }
return currentCollisions
} }
void Update() void Update()
{ {
GetIngredients() GetIngredients();
} }
// Keep track of ingredients going on and off the cooker.
List <GameObject> currentCollisions = new List <GameObject> ();
private void OnTriggerEnter2D(Collider2D other) {
currentCollisions.Add (other.gameObject);
}
private void OnTriggerExit2D(Collider2D other) {
currentCollisions.Remove (other.gameObject);
}
} }

View File

@@ -3,8 +3,8 @@
--- !u!55 &1 --- !u!55 &1
PhysicsManager: PhysicsManager:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 13 serializedVersion: 14
m_Gravity: {x: 0, y: -9.81, z: 0} m_Gravity: {x: 0, y: 0, z: -9.81}
m_DefaultMaterial: {fileID: 0} m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2 m_BounceThreshold: 2
m_DefaultMaxDepenetrationVelocity: 10 m_DefaultMaxDepenetrationVelocity: 10
@@ -19,9 +19,10 @@ PhysicsManager:
m_ClothInterCollisionStiffness: 0.2 m_ClothInterCollisionStiffness: 0.2
m_ContactsGeneration: 1 m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1 m_SimulationMode: 0
m_AutoSyncTransforms: 0 m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1 m_ReuseCollisionCallbacks: 1
m_InvokeCollisionCallbacks: 1
m_ClothInterCollisionSettingsToggle: 0 m_ClothInterCollisionSettingsToggle: 0
m_ClothGravity: {x: 0, y: -9.81, z: 0} m_ClothGravity: {x: 0, y: -9.81, z: 0}
m_ContactPairsMode: 0 m_ContactPairsMode: 0
@@ -33,5 +34,6 @@ PhysicsManager:
m_FrictionType: 0 m_FrictionType: 0
m_EnableEnhancedDeterminism: 0 m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1 m_EnableUnifiedHeightmaps: 1
m_ImprovedPatchFriction: 0
m_SolverType: 0 m_SolverType: 0
m_DefaultMaxAngularSpeed: 50 m_DefaultMaxAngularSpeed: 50