I’m currently trying to create an game based on infinity plateform ascension. To do it, I use prefabs with multi-children.
On each of these prefabs, i placed 2 points (Top/Bottom).
I want that the bottom of the next prefab to be on the top of the previous one.
I thaught i could use the prefab center to calculate the right position.
But when i Instantiate it, it doesn’t fit. In fact, i understood that the transform.position of the prefab is not the middle of the prefab. ( Like on this picture )
Is there a way to set the prefabs transform position at the right place ?
Or have you got any better idea to perform this ?
Yes, i selected everything. Look these pictures. According to the selections tools. They all give me the center of the prefab. Which is actually nothing.
The last tool on the right shows me the real prefab transform.position because when i move the position in C#, this point is taken as transform.position.
I found some kind of stupid fix :
create an empty GameObject
keep its position in mind
selected all children of the prefab and move them to the empty gameobject position
attach them to this empty gameobject.
It’s the new prefab with the good transform.position
Any idea of why it’s not automatic ?
Anyway i found the solution, quite simple. Don’t know why i was stucked for one day. I just had to calculate the distance between the prefab transform.position and my bottom point and substract it to prefab transform.position.
Hmm, but if you had selected the parent only, then it would be quite odd if the translation widget wouldn’t be at the same position transform.position gave you.