Search Unity

Physics2D.BoxCast return incorrect info (5.2.2f1)

Discussion in '2D' started by ZeuX, May 22, 2016.

  1. ZeuX

    ZeuX

    Joined:
    Oct 11, 2013
    Posts:
    13
    Hi there,
    I'm writing a custom 2D physic system
    what I have a issue is
    when I call Physics2D.BoxCast
    it return wrong info
    as this picture shows
    I cast a box to right
    and it absolutely should not be 0 angle

    I think it's because it is corner
    but It should return one of two edge's angle instead(from hit.normal)
    this will cause my character go through ground
    because it think the right side is flat
    since it happen rarely
    but that's just not right

    my unity version is 5.2.2f1
    is new version after this fix it or not?

    edit:
    I have a concept here
    let's say I cast to straight right

    the rules should be like this

    all judgement base on the cast direction

    this can not be done if unity don't fix it
    I don't wanna use violence way to make it happen
    so please help
    really thanks
     
    Last edited: May 22, 2016
  2. ZeuX

    ZeuX

    Joined:
    Oct 11, 2013
    Posts:
    13
    I found why this happen
    because in the top picture
    it actually contains all situations in second image
    then as the result it take the third one

    and the key to make this happen is the middle gap line
    between 2 edges

    Unity should not take that line to collide with
    that's must to be ignored because it's even not generate by polygonCollider2D's points

    hope someday this can be fix
    or the 2D collide system is very unreliable