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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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.