Below is a picture depicting “I”, “J”, “L” game objects. Each object has children. These children are blocks and a pivot.
I want to instantiate game objects relative to their child Pivot, but I do not how to do it.
I have a script that instantiates these objects
public GameObject[] Shapes;
public Vector2 beginPoint;
public Vector2 resize;
public float offsetBetweenBlock;
private const int numberToShow = 3;
...
for(int i = 0; i < numberToShow; i++)
{
GameObject currentShape = Shapes[Random.Range(0, Shapes.Length)];
Instantiate(
currentShape,
new Vector3(beginPoint.x + i * offsetBetweenBlock, beginPoint.y),
Quaternion.identity,
transform
);
}
But as you can see “J”(Medium) and “L”(Right) are not equal to each other (I pointed at them with red arrows on the picture)
How can I instantiate objects “I”, “J”, “L” with respect to their child Pivot?
