Search Issue Tracker

Not Reproducible

Votes

28

Found in

2017.2.0f3

Issue ID

962315

Regression

No

Colliders are not updating to match attached gameObject location

Physics

-

-

Priority: 7Not yet prioritized for a release

-

Severity: 2No workaround

Colliders are not updating to match attached gameObject location. After their object is stored and returned from a pool (reparenting, deactivating and re-activating the gameObject in the process) they become stuck at the location they were at when first activated. The collider gizmo does not reflect this.

To reproduce:

1. Download attached project "WoP Bugreport.zip" and open in Unity
2. Open "bug_example" scene and enter Play mode
Note: Enable gizmos in the game view for better visual cues to raycasting
3. Using a gamepad navigate the player character to the weapon on the ground and pick it up using the 'B' button (XBOX controller)
4. Use the 'X' button (XBOX controller) to fire the weapon at the enemy, killing them and causing them to return to the pool.

Notes:
- The enemies spawn one at a time from a pool of 10 total.
- After the 10th enemy has been dispatched they will start recycling. At this point observe that both the aim assist feature and the collision of projectiles confirm the enemy's collider remains at their initial spawn point as they move about.
- By selecting the enemy in the hierarchy and disabling/enabling their sphere collider, observe that it moves to the latest position of the game object but does not update.
- Workaround: By adjusting any property of the sphere collider, observe that the collider now begins to follow the game object as would normally be expected
- This issue appears on Unity Editor and Standalone Build

Reproduced on Unity 2017.2.0f3 and 2017.2.0p1
Not reproduced on Unity 2018.1.0a2
Could not check for regression on Unity 2017.1 and 2017.3 because XBOX Controller does not work for some reason

Comments (27)

  1. 2130e7fcd6ab3c29ce91329ddb383b23?d=mm

    Lipoly

    Aug 13, 2018 13:23

    Can also confirm it is fixed in 2018.2.3f1, just confirmed it in my repro project: https://unity3d.com/unity/whatsnew/unity-2018.2.3

    "Physics - Fixed an issue where a Collider's underlying PhysX Transfrom did not update correctly when reparenting."

  2. 5e6460facbd5648f3f076fd69ca9c150?d=mm

    benVisiativ

    Aug 13, 2018 09:02

    it's fixed on the 2018.2.3f1 !
    thanks

  3. Adda669a1477f2ebf8df805aa86392e1?d=mm

    podoshvadev

    Aug 09, 2018 18:13

    Also, I have got this issue on the Unity 2018.2.2f1. I updated from 2018.1.0f2 to 2018.2.2f1 and after running my project, game objects which ware Instantiated from prefab, them colliders didn't work correctly. Game Objects with the Rigidbody component could go right through these.
    Rigidbody:
    IsKinematic = false
    Colliders:
    IsTrigger = false

    But if I use this code in Game Objects which were ware Instantiating from prefab, Colliders were working.

    private void Start()
    {
    Collider mCollider = GetComponent<Collider>();
    mCollider.enabled = false;
    mCollider.enabled = true;
    }

    When I changed Unity version on 2018.1.0f2 from 2018.2.2f1, everything started working correctly as it worked before the update.

  4. C1d294764fc31cf2d8055ecd7cb4d90f?d=mm

    Sir_Everard

    Aug 09, 2018 15:19

    on version 2018.2.2f1

  5. C1d294764fc31cf2d8055ecd7cb4d90f?d=mm

    Sir_Everard

    Aug 09, 2018 15:18

    Had this issue aswell. As suggested in the commens, setting the parent before moving the object seems to work.

  6. B48f59299c49c9ed6ef6e20e437a1fde?d=mm

    P_Ottensamer

    Aug 07, 2018 18:51

    we are having issues with this as well. It mainly happens when we create primitives and then change their transform values. the colliders do not update correctly.

    This has been happening since 2017 and our solution was, to just deactivate the collider, wait one frame and then enable them again.

  7. 5b9274f484b99cf1c1bb49db6ea3cdd2?d=mm

    Krueg82

    Aug 05, 2018 01:26

    I am having a similar issue in 2018.2.2f1. After instantiating a prefab and setting it's parent, if I set the transform.localPosition to Vector3(0, 0, 0) the object is placed in the correct position but the collider is at the world origin rather then the local origin. The collider gizmo draws in the correct place in the scene view though. If I nudge the object in the scene view the collider's position updates and it works as expected after that.

  8. 39000c4287a57944cdf27a7ccda121c1?d=mm

    kerethros

    Aug 02, 2018 14:43

    Just downloaded 2018.2.1f1 and this same issue happened to me. This happened to me also a couple of days before on a personal project i'm doing at home. I instantiate an object, set up its position and later set up its parent, somehow leaving the collision box way off from where it should be working (mind you, the box still appears in its correct position when I checked on the editor). Moving slightly the object made it work again correctly.

    MISTERFOOGY's workaround worked for me. Just set the parent BEFORE giving the object its position, which also made sense since unparented instantiated objects didn't suffer from this bug in my project.

    It's a quick work around but it's game ending if you don't luck out and find a thread in the issue tracker in time like I did.

    Thanks guys.

  9. 2a9c3e3807b17f51a7cbb4ffdaa38ea8?d=mm

    Roobubba

    Aug 01, 2018 10:45

    I just updated to 2018.2.1f1 and my entire game was broken due to this issue.
    I used the fudge that MisterFoogy mentioned (thanks MisterFoogy!!) of setting position *after* parenting to ensure that colliders on child objects are actually moved with their gameobject, and it works.

    This needs to be fixed at the engine level as it's clearly a bug, and - at least in my case - an entirely game-breaking one.

  10. 5e6460facbd5648f3f076fd69ca9c150?d=mm

    benVisiativ

    Jul 25, 2018 09:30

    By the way the bug is set as "Not Reproducible".
    But it is very easily reproductible.
    Just do as MAGIS_MARC says :
    "I get the problem when via script I re-parent a child game object to a temp-dummy object, transform the gameobject (containing the collider), and then reparent it back to its original parent . The collider remains stuck where the mesh was spawned."

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.