Search Unity

Unity 5 collision issue in block based game (box colliders)

Discussion in 'Physics' started by Disastorm, Mar 9, 2015.

  1. Disastorm

    Disastorm

    Joined:
    Jun 16, 2013
    Posts:
    80
    Hello,
    Unity 4 didn't have this issue, but in Unity 5 I have a game that is constructed in blocks with box colliders and I was able to push a box horizontally over them(by setting rigidbody.velocity to a specified value) with no issues in Unity 4.

    However, in Unity 5 the pushable-boxes appear to be colliding with the next ground-box in such a way that it prevents the pushable-box from moving unless rigidbody rotation is enabled, in which case the blocks flips over. However, the expected behavior (which worked in Unity4) is that the box should push over perfectly since the next ground-box is at the exact same y-coordinate and same dimensions as the current ground-box under the pushable-box.

    For example:

    P = pushable box
    G = Ground box

    P
    GGGGGGG


    P should be able to be pushed to the right over all of the G boxes with no issues as it did in Unity 4. However in Unity 5, once it reaches the border to the next G box it will flip over (or if rotation is disabled, it will stop moving).

    Does anyone know a solution to this issue in Unity 5?
     
  2. Disastorm

    Disastorm

    Joined:
    Jun 16, 2013
    Posts:
    80
    I found a workaround to this by basically nudging the box 0.001 magnitude in the direction using transform.Translate of the push with every collision between the Player Controller and the Box and this allows me to still use the rigidbody physics with my object, the 0.001 nudge is small enough to not make a difference in the pushing but its enough to overcome the collisions with the ground blocks.
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    2,172
unityunity