Search Issue Tracker

By Design

Votes

1

Found in

6000.0.49f1

6000.1.4f1

6000.2.0b3

Issue ID

UUM-107327

Regression

No

Mesh colliders are not updating their positions of bounds correctly

-

Reproduction steps:
1. Open the attached “IN-102524_Starhome.zip“ project
2. Open the “Assets/Scenes/MainGame.unity“ Scene
3. Enter the Play Mode
4. Rotate around with middle mouse button in the Game View until you see the shipwreck
5. Try to select/unselect it multiple times

Expected result: The GameObject is selectable/raycasts work as expected
Actual result: It is rarely selectable, raycasts are not consistent

Reproducible with: 6000.0.49f1, 6000.1.4f1, 6000.2.0b3
Couldn’t test with: 2022.3.62f1 (due to script errors)

Reproducible on: M1 Max MacOS 15.1.1
Not reproducible on: No other environment tested

Note: After disabling and enabling the “Wreck(Clone)“ GameObjects, the mesh colliders and raycasts work as expected

  1. Resolution Note:

    We've investigated the issue and it seems the problem is in user's code.

    When the MainGame scene is played, we can see a couple of `Wreck(Clone)` objects instantiated. If we check the hierarchy, we can see that the parts with colliders (`Bridge2`, `Bridge3`, etc.) do not have matching geometry and collision. The colliders are a lot smaller and do not match the geometry at all. This is because of user's code lines 50 and 51 in `Mine.cs`. These lines change the parts' localScale *post* instantiation without triggering a rebake of the mesh colliders. The fact that the assigned local scale is random also explains the randomness of reproducibility of the bug - it depends on how large the mismatch between the post instantiation local scale and scale on instantiate are.

    The same can be reproduced by simply dropping the Wreck prefab into scene during Editmode and adjusting the scale of each of the parts - this also results in geometry no longer matching the baked collision until the MeshCollider is reenabled or the mesh is reassigned to trigger a rebake. It's a relatively expensive operation therefore it's not done automatically and requires extra steps from user to trigger it.

    Recommendation is to either trigger enable/disable of the component via scripting during the scale changes or unassign/assign the target mesh of the MeshCollider component.

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.