Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

2D Crushing a circle if enough force is applied.

Discussion in 'Physics' started by PeytonHanel, Jul 31, 2016.

  1. PeytonHanel

    PeytonHanel

    Joined:
    Aug 14, 2014
    Posts:
    7
    So I have this idea that a 2D circle in my game should be crushed if an object falls on it with enough force. And by crushing, I mean if the circle is hit hard enough the line "Destroy (gameobject);" is executed. All I really need to go about doing is figuring out how much force is being applied to the circle, say, if it gets hit hard enough, if it gets pinned between two objects, even if there is just an object sitting on top of it and its mass is great enough. How would I go about figuring out how much force is applied to my circle. :D
     
  2. MoonJellyGames

    MoonJellyGames

    Joined:
    Oct 2, 2014
    Posts:
    324
    This should be fairly easy, I think. In your OnCollisionEnter2D function, you can check the mass of the colliding object, where it is in relation to your other object (above, below, etc.), and (I think) the colliding object's velocity at the moment of impact.
     
  3. PeytonHanel

    PeytonHanel

    Joined:
    Aug 14, 2014
    Posts:
    7
    I was having trouble getting all the contact points from the collision event. I had 2 objects touching my circle though my console was only showing one contact point. So im unsure how to figure out if the two are opposite each other when I can't view all the contact points