H
H
hipa2021-11-29 23:18:43
Unity
hipa, 2021-11-29 23:18:43

Problem with child objects, how to solve?

I have a Player object and its children DocherniyObject
They appear in the same place as the parent with coordinates 0,0,0
If I rotate the Player, the children will rotate with it
The problem is that when I rotate it, the child objects have a degree their rotation in Transform.rotation(0,0,0) is not counted, all zeros
AND when I try to move one of the child objects up:
this.transform.position = new Vector3(0,10,0);
Instead of moving up, it moves sideways because it is rotated with the help of the parent
. How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-11-29
@hipa

Are you sure you need them as child objects? This is the first.
Second, why are you touching transform.position when you most likely need transform.localPosition. And he gets up not somewhere to the side, but at 0,10,0, as requested. In general, read about global and local space.
Third, if you really want to, then level the rotation of the parent in antiphase. But as soon as the parent of the parent appears, you will know Zen :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question