Search Issue Tracker
By Design
Votes
0
Found in
2020.3.45f1
2021.3.20f1
2022.2.8f1
2023.1.0b6
2023.2.0a3
Issue ID
UUM-29082
Regression
No
GameObject Position changes when its child Collider is rotating
How to reproduce:
1. Open the project “IN_32375”
2. Enter the Play Mode
3. Select Scene view
4. Select the “Cube” GameObject in the Hierarchy
5. Observe the Transform Position values in the Inspector
Expected result: Position doesn’t change
Actual result: Position changes
Reproducible with: 2020.3.45f1, 2021.3.20f1, 2022.2.8f1, 2023.1.0b6, 2023.2.0a3
Reproducible on: Windows 10 Pro
Notes:
- Reproducible both in Player and Editor
- Doesn’t affect GameObjects with Mesh and Wheel Colliders
Comments (2)
-
Augustinas-Simkus
Mar 07, 2023 09:21
Hey, I would advise each moving part to have its own Rigidbody. That's because Rigidbodies are supposed to be rigid, they represent a single non-deformable physical body. Deforming it every frame is a bit like fighting the system :D
If the movement of the child needs to be constrained in some way, you can use joints to enforce that. For example, in the provided project the child was rotating around one axis, it could be connected via a Hine Joint to the parent to enforce that and the motor of the joint could be used to make that constant rotation happen (as opposed to rotating the Transform each frame).Best regards,
Augustinas -
fdg
Mar 06, 2023 18:35
Hi. Thx for checking this out. Please could you advice what to do in cases where child of an entity needs to be rotated and would need to have collider also?
Would you advice Having rigid body on it also? (heard that this is not very good idea)
Or maybe its better solve it by some kind of physics joint?
Or any other idea?Regards
Greg
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Some UXML Template Asset foldouts appear enabled when all fields inside are disabled
- URP Terrain Demo crash on burst_signal_handler after Generating lighting
- Project window button icons are poorly visible and their shades differ in Light theme
- GC.Alloc called by HDRenderPipeline.LensFlareMergeOcclusionDataDrivenPass() when playing the default HDRP Sample Template project
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
Resolution Note:
The problem with rotating a Collider (that belongs to a Rigidbody) every frame is that the mass distribution is constantly changing and the center of mass needs to be recalculated each time. The floating point imprecisions from these calculations stack over time and the whole thing slowly drifts away.
Workaround/solution: rotate the Rigidbody, not the Collider to avoid center of mass drift each tick.