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

2017.2 b11 - Box colliders incorrectly placed when parent object is moved from script

Discussion in '2017.2 Beta' started by Flarup, Sep 30, 2017.

  1. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    I have a setup in which a bunch of game object with Box Colliders on them are placed under an otherwise empty game object. The child game objects have scale SMALLER than (1,1,1). I then move the parent game object from code, and this causes SOME of the colliders to be incorrectly placed afterwards.

    Ingame I can clearly see the bug because raycasts can hit colliders that clearly shouldn't be at that position (all game objects with colliders have a rendered mesh as well, so I can clearly see the mismatch between mesh and collider), and some times raycasts does NOT hit a game object, even though I clearly expect there should be a collider at that position.

    But when I debug in scene view the green collider gizmo is drawn at the "expected correct" position, right on top of the mesh renderer. However, when the Move tool is placed at the Center of the object in scene view, then I noticed that it not at all was placed correctly, as can be shown here:

    upload_2017-9-30_10-19-16.png

    As can be seen on the picture, the "center" of the game object is clearly off, but it's related to the fact that the Box Colliders is at a completely different position (even though the green collider gizmo is "correctly" drawn where it SHOULD be).

    If I in scene view tick the Box Collider off/on, or tick IsTrigger off/on, then it "snaps back" to the correct position. However, doing that from code doesn't seem to solve the problem unfortunately.

    This appears to be a bug in the Physics code that should be fixed.

    Meanwhile, is there some method in the Physics code I can call which potentially could be used as a work-around for now, to recalculate correct positions of moved colliders?

    Thanks a lot in advance.


    Kind regards,
    Uffe Flarup
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,398
    If you think you found a bug in Unity, I recommend to submit a bug-report following the advice in this document. From my experience, without submitting a bug-report, it's unlikely that UT is going to fix or even take a look at this issue.

    Using the bug-reporter seems to be an important step, because it makes sure the report is in Unity Technologies bug-tracking pipeline and has to be processed at some point. Using the forum is often used to add to a little more attention to a bug-report, but does not replace submitting the bug-report.

    It's from advantage to attach a project to the bug-report that UT can use to reproduce the issue and test their fix against. The easier an issue can be reproduced by QA, the more likely it is to get forwarded to a developer, who might or might not work on a bug-fix for that at some point.

    After you submitted the bug-report, you receive a confirmation email with a Case number. UT often asks us to post the Case number in the forum thread, which allows them to find that bug-report if they look at your post.

    Following these steps will increase the chance that UT is looking at your issue tremendously.
     
    Prodigga likes this.
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,103
    Hi Uffe,
    As Peter already said, it would be of great help if you could submit a bug report with a minimal reproduction case and reply in here with the case #.