Search Issue Tracker

Not Reproducible

Votes

36

Found in

2017.2.0f3

Issue ID

962315

Regression

No

Colliders are not updating to match attached gameObject location

Physics

-

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 (43)

  1. m4a44

    Apr 05, 2019 14:25

    Just had this where a child object with a kinematic trigger collider and rigidbody (not moved, except by collider and rigidbody on parent) wasn't updating the physics transform.

    Using "transform.localPosition = transform.localPosition;" in the update fixed it for me.

  2. CookieSalad

    Oct 02, 2018 14:38

    Hey everyone!

    If you're able to reproduce the issue, please consider using the Unity Bug Reporting tool and sending us a small repro project. The current one that we have access to is neither debuggable, nor strippable and we weren't able to reproduce the issue internally by creating a simple repro project ourselves.

    Send us as many projects as you can! When uploading your project, fill the description out fully as usual and also leave "case 962315" somewhere in the description so that we may associate the issues easier.

    Thank you for your patience and cooperation!

  3. pavlik1307

    Aug 24, 2018 09:44

    I have updated Unity to 2018.2.5f1 and still have the issue. I'm animating my game object which has mesh and collider by scaling it down. Collider updates when I reenable Box Collider itself or reenable it's IsTrigger property. I noticed that collider updates correctly when I put my game object into another empty game object and when I animate this empty game object's scale instead of my game object's scale.

  4. pastaluego

    Aug 22, 2018 14:51

    After some testing I've discovered that 2018.2.4f1 doesn't seem to sync transforms automatically in editor anymore if transforms are moved without a rigidbody.
    Despite Physics2D.autosyncTransforms being enabled, if I move a transform with a collider2D in update without a rigidbody, unity editor doesn't sync the transforms on move. (Which may end up being a good thing performancewise).

    But if I manually call Physics2D.SyncTransforms after every move, the unity editor properly updates the collider with the movement. This may be an intended change since transforms with rigidbodies don't actually 'move' anyway until the physics step, but in my case I need immediate transform movement.

  5. pastaluego

    Aug 22, 2018 14:33

    I'm having this issue after updating from 2017.x to 2018.2.4f1. It only happens for my objects interpolating with this method: http://www.kinematicsoup.com/news/2016/8/9/rrypp5tkubynjwxhxjzd42s3o034o8

    I've been doing it this way since ~5.6 and have never had issues before. It only happens in editor playmode where collider isn't matching the transform movement immediately. If I move the transform, then refresh the editor in some other way (like clicking on inspector or clicking a tool in editor), the collider will then update to the new position. But it's not automatically updating anymore.

  6. cxode

    Aug 21, 2018 05:27

    I too had this bug fixed by updating to the latest Unity version

  7. 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."

  8. benVisiativ

    Aug 13, 2018 09:02

    it's fixed on the 2018.2.3f1 !
    thanks

  9. 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.

  10. Sir_Everard

    Aug 09, 2018 15:19

    on version 2018.2.2f1

Add comment

Log in to post comment

All about bugs

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