- Home /
crush object based on pressure/weight from sides
I'm wondering how I can detect the amount of force being exerted on an object, from any direction, so that I can simulate it being crushed. I think figuring out the weight on top of something wouldn't be too hard, but I'm not sure how to tell if I should "crush" something if the forces are coming from one or both sides. Like squishing a grape between both hands. Thanks for you help in advance.
So on my destructible object I added this code to destroy an object based on it's strength. Seems to work great.
void OnCollisionStay(Collision collisionInfo) {
if (collisionInfo.impulse.magnitude > strength) {
Destroy (gameObject);
}
}
I still have a problem of if an object gets smashed between 2 other objects, it will break even if it's strength is greater. Not sure how to overcome that yet.
Use comments and not answers when you don't have an answer!!! Converted to comment.
Your answer
![](https://koobas.hobune.stream/wayback/20220612054057im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Empty GameObjects fly away. 2 Answers
Bend object with physics interaction 0 Answers
Predicting land position with drag applied 0 Answers
Force in Circular Motion 1 Answer
Calculating required force for pushing a body to a desired position at once 0 Answers