M
M
MagicalPrincessFromAnothe2019-10-09 22:37:21
Unity
MagicalPrincessFromAnothe, 2019-10-09 22:37:21

Why does the parent's origin move to the child's origin?

Hello. Created a 2D project in Unity. I created an empty object, I create a cube next to it. As soon as I put the cube in an empty object in the hierarchy panel (the panel on the left, where all the objects on the stage are shown), the center of the empty object's coordinates moves to the center of the cube's coordinates (that is, its starting coordinate (0, 0, 0) is now in the center of the cube , and not in world coordinates (0, 0, 0). Who knows how to fix it. Through the code, the same garbage.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MagicalPrincessFromAnothe, 2019-10-09
@MagicalPrincessFromAnothe

Hello. I have never run into this problem myself, and the uncles with higher ratings above (or below) this comment are right, but did not answer my question. The problem is solved in such an interesting way (although I don’t understand how it works at all. Okay in the viewport, but through the code it also worked as it should. Really strange)
Solution5d9e3ce1a79f5550907795.png

G
GavriKos, 2019-10-09
@GavriKos

The inspector always shows local coordinates - i.e. coordinates relative to the parent object.
Through the code, you can get both local and global coordinates.
There is nothing to fix here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question