Search Issue Tracker

Won't Fix

Votes

0

Found in

2017.4.0f1

2018.4.0f1

2019.1.0f2

2019.2.0a1

2019.3.0a1

2020.1.0a1

Issue ID

1188463

Regression

No

Setting Transform.position of a child GameObject to its own Transform.position sets it imprecisely

Physics

-

How to reproduce:
1. Open user-submitted project (ObjectDrifting.zip)
2. Open the 'ObjectDrift' scene
3. Enter Play Mode
4. Select the Parent/Drifting Object in the Hierarchy window

Expected result: the transform position of the child object does not change
Actual result: the transform position of the child object slowly changes

Reproducible with: 2017.4.32f1, 2018.4.10f1, 2019.2.8f1, 2019.3.0b5, 2020.1.0a7

Notes:
Does not affect GameObjects without a parent GameObject

  1. Response avatar

    Resolution Note:

    This is a result of floating point precision errors when calculating the global position of a child object.
    When setting or retrieving the global position it has to be calculated from the local position as it is not stored.
    The assignment here causes a call to get position and set position of the transform, each of which has a small level of inaccuracy. The rotation of the parent amplifies the issue.
    We suggest setting the local position of child object with transform.localPosition where possible. Global positioning of child objects will always require more calculation overhead therefore potential floating point imprecision.

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.