I setup my camera to point at a green plane that is position at (0, -1, 0 ) ; so, I think the camera is position downwards of the Y axis.
transform.Translate(new Vector3(0, 150, 0));
transform.LookAt(land.transform);
I want to render a checkerboard like tile sheet on top of the plane, but I’m not sure how to do it. I tried instantiate clones with the screentoworldpoint function from the camera, but I’m not getting it to position correctly.
bool switch_tile = true;
for(int y = 0; y < 256; y += 16)
for(int x = 0; y < 256; y += 16)
{
Vector3 p = camera.ScreenToWorldPoint(new Vector3(x, y, 1));
if(switch_tile)
{
//red tile instantiated
Instantiate(red_tile, p);
}
else
{
// black tile instantiated
Instantiate(black_tile, p, Quaternion.identity);
}
switch_tile =! switch_tile;
}
any advice ?