Search Issue Tracker

By Design

Votes

4

Found in

2019.4

2020.3.5f1

2020.3.10f1

2021.2

2022.1

2022.2

Issue ID

1388024

Regression

Yes

Hinge joints don't stabilize when its Connected Body was moved

Physics

-

Reproduction steps:
1. Open attached project "Repro"
2. Open "SampleScene" Scene in the Scenes folder
3. Enter Play Mode

Expected result: after 2 seconds "yoke" GameObject is not moving
Actual result: after 2 seconds "yoke" GameObject is moving

Reproducible with: 2019.4.34f1, 2020.3.10f1, 2020.3.26f1, 2021.2.8f1, 2022.1.0b4, 2022.2.0a2
Not reproducible with: 2020.1.0a1, 2020.3.9f1

  1. Resolution Note:

    The behavior is as expected. Let's imagine the following GameObject hierarchy:

    root (Rigidbody)
    -> nodeA (Collider)
    -> nodeB (Empty GameObject)
    -> leafB (Collider)

    The Rigidbody designated as 'root' will have it's center of mass and inertia tensor computed based on the shapes which influence it, namely 'nodeA' and 'leafB'. Removing either of these shapes will cause the Rigidbody to have said properties recalculated.
    Now if we do the following change to the hierarchy:

    root (Rigidbody)
    -> nodeA (Collider)
    -> nodeB (Rigidbody)
    -> leafB (Collider)

    The Rigidbody designated by 'nodeB' is now taking over the shape provided by Collider 'leafB', this will detach the shape from Rigidbody 'root'(which will cause a recalculation of center of mass and inertia tensor). Previously there was an issue (https://issuetracker.unity3d.com/issues/inertia-tensor-is-not-reset-when-a-collider-is-removed) which would cause center of mass and inertia tensor to not be recalculated when detaching a shape (by removing the Collider component for example), prior to said issue being resolved the Rigidbody 'root' from our example would keep it's properties intact as we wouldn't recalculate them (which was definitely wrong).

    In order to still satisfy the behavior this issue refers to, a simple solution would be to cache the center of mass and inertia tensor of the 'root' Rigidbody (using the example above as reference) before adding the new Rigidbody to 'nodeB' and setting it back afterwards.

Comments (3)

  1. welinkgro

    Apr 09, 2022 07:55

    Thanks for share.

  2. AndersMalmgren

    Jan 19, 2022 14:54

    Here you can see video of problem 2020.3.5 stable vs 2020.3.24 unstable

    https://issuetracker.unity3d.com/product/unity/issues/guid/1388024

    Thanks

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.