Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"Physics.ColliderCast" / force-checking if any rbs touch a trigger multiple times in a frame

Discussion in 'Physics' started by GeorgesAbitbol, Mar 16, 2015.

  1. GeorgesAbitbol

    GeorgesAbitbol

    Joined:
    Apr 11, 2014
    Posts:
    6
    Hello,

    I have a situation where I need to find a free volume during a frame.
    Apparently I have no other choices but to use rigidbodies & triggers for that.

    My logic is as follow :
    - As long as my trigger has any rigidbody touching it, move it back one step
    - If no RB touches the trigger, I've found the free space I needed.

    Problem :
    - The trigger collision is not updated until next physical frame so I cant do my whole routine in a single frame.

    So im looking for a solution, one I thought of was using some form of Physics cast, but spherecasts arent good for what I want as my trigger is not always the same size (always a box, but not always a cube).

    Any suggestions ?


    WHY DOES THE WORLD HATE ME ?! ~ (°^ °; ) ~
     
    Last edited: Mar 17, 2015
  2. GeorgesAbitbol

    GeorgesAbitbol

    Joined:
    Apr 11, 2014
    Posts:
    6
    I couldnt find a solution and had to rethink the whole logic.
    Found a much cleaner solution now, altough its also a little less automated for the user, but in the end it works well.