Quantcast
Channel: Questions in topic: "parenting"
Viewing all articles
Browse latest Browse all 302

Is there a way of correctly parenting to get scales and positions of gameObjects right?

$
0
0
Originally, I was doing this: void Update () { this.transform.position = new Vector3 (previousObject.transform.position.x + prevRend.bounds.size.x / 2 + rend.bounds.size.x / 2, this.transform.position.y, this.transform.position.z); //the position of both gameObjects should be aligned when one or both of their scales change } But because gameObjects didn´t update their positions fast enough (caused gaps for small amounts of time), I thought maybe making something different. So I commented the rest of my doings earlier, which is basically changing the scale of a parent object based on a percentage to make its children do the same. Their positions changed automatically, avoiding the gaps that I had. Also this works with the correct proportions for every gameObject and even the positions are right... when including everything. I wanted to increase or decrease size of some of this gameObjects independently to the others, but when these are out of the parent the positions are not aligned anymore. Is there some way of correctly parenting them and get both things right?

Viewing all articles
Browse latest Browse all 302

Trending Articles