Question by
Kuch_1 · Apr 27 at 11:06 PM ·
c#childrencoordinateschild object
Find child coordinates and pass them further?
I have a list of objects and a script to show one object randomly. How I can receive the coordinates of the active objects' child, so I can pass them further? I wanna world coordinates to be written into x,y, and z.
Here is the script:
public GameObject[] objects;
public int objNumTrunk;
public int objCountTrunk = 0;
public float x;
public float y;
public float z;
public void OnMouseDown()
{
objNumTrunk = Random.Range(0, 3);
objCountTrunk = 0;
while (objCountTrunk < 3)
{
objects[objCountTrunk].SetActive(false);
objCountTrunk += 1;
}
objects[objNumTrunk].SetActive(true);
}
screenshot-27.png
(5.1 kB)
Comment