Hey everyone!
I’m making a cooking game, and I was wondering if it’s possible to detect when an object (let’s say a knife) slices through another object (a burger bun, for example). I’m not trying to slice the second object into two, just trying to detect when an object goes through it. Thanks!
It depends on how much realistically do you want to do it. If you want to just detect collision with the knife you can use method OnTriggerEnter of OnTriggerStay to detect the slicing. I would probably go for some smart placement of trigger colliders on your knife and smart detection in scripts. For example you can put a trigger collider on your sharp edge of your blade which should be the first one to fire OnTriggerEnter with the food collider. Then it should be followed with OnTriggerEnter from trigger placed on the rest of the blade. If you have a cutting board I would be detecting OnTrigger enter with the knife on it and check whether the blade is still inside the food (OnTriggerEnter wasnt called). If so I would slice the food.
To detect collision from a specific collider you need to put a rigidbody on it and also a new script with those methods. In another words object with rigidbody attached detects collisions of all colliders down the hierarchy.