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

Objects falling into or passing through other soft/jello-like objects?

Discussion in 'Scripting' started by UnbridledGames, Feb 24, 2021.

  1. UnbridledGames

    UnbridledGames

    Joined:
    May 12, 2020
    Posts:
    139
    I posted this a month ago in the Physics section and it didn't get any replies, figured I'd try posting it in scripting as it's likely more of a scripting issue than a physics one.

    I have some code that creates realistic piles of items by dropping them and letting them land 'naturally'. Works great, except when I had a heavy, thin, flat gear. It was always just lying flat, hitting the hard ground on it's edge, and falling over. Makes sense, but if you threw something like this onto soft earth, there's a chance it would land in such a way that the edge would sink into the ground, and it could be stuck in the ground, not laying flat. This could also be applicable for firing things through soft targets like a ballistics gel.

    Is there a way in the physics engine, or standard Unity scripts, to make an object "soft" so that other objects/colliders could pass through them? Or maybe an existing asset (which is not too expensive)? Worst case I might have to code it myself, but trying to save that time.

    It's clearly not the first time something like this is needed, just surprised I cannot find any reference to it anywhere.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Joe-Censored likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'd see if increasing the value of rigidbody.drag or rigidbody.angularDrag on impact with the ground gives you the desired affect.
     
  4. UnbridledGames

    UnbridledGames

    Joined:
    May 12, 2020
    Posts:
    139
    None of what I've looked at seems to do what I want. It's a minor feature for the app I'm working on, so I'm shelving the idea for now. Once the feature becomes worth playing with again, I have a few ideas on how to achieve it. I'll post something once I do something with it. Thanks for all the info.