Hey guys
So ive got a game that spawns cubes, how boring, but im improving it, anyways i need some help
so ive spawned a cube, and i can add a cube to which ever side i want, and i can resize the cubes by clicking on them
now my problem comes when i resize them here is the code
if (hit.normal == hitGameObject.transform.forward)
{
hitGameObject.transform.localScale += new Vector3(0.1F, 0, 0);
GameObject.Find("cube1").transform.localPosition += new Vector3(0.1F, 0, 0);
}
ok so that all works like i want it to, when i click on the object it sizes by 0.1F and the Object to the left which is cube1 moves also by 0.1f, but im gonna be spawning alot of cubes, so i dont want to have to have that line in that Finds Cube1, rather i would like it to take the Cube im looking at which is hitGameObject, and find the cube to the left of it and the right of it, and move them by 0.1f and -0.1f
so really i would like help in finding how i can find the object next to the object im looking at, without using its name, but more like distance and orientation if you know what i mean
Appreciate the help guys, and ask questions if you dont understand. ![]()