Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Collision to allow penetration of rigidbody collider

Discussion in 'Physics' started by miniduck, Feb 1, 2015.

  1. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    I have a couple of simple colliders(sphere, box) + a rigidbody.
    I want to rigidbody to be able to a certain point penetrate the collision object but get forced out the larger the penetration is.
    How can this be achived?

    Search through the forums but couldn't find a way

    Thank you very much!
     
  2. Uberpete

    Uberpete

    Joined:
    Jan 16, 2014
    Posts:
    78
    Colliders aren't supposed to work that way. I'd recommend writing a script along these lines...

    1. When another collider enters a trigger, disable our collider.
    2. Calculate the distance between the inner-most vertex of the penetration and the point of penetration.
    3. Calculate some sorta value that compliments that.
    4. Apply a force in the opposite direction.

    Hope this is somewhat helpful :)