Scaling and Moving of Objects

Hi. I got a tricky problem with the unity engine:

I created a plane (my terrain) and scaled it to 10,1,10 and a camera which should move on it.
On the plane I attached a texture which should divide the plane into squares (I used the tile feature for this).

Now the problem:

  • How could I move the camera just one square?

I tried some time, but the scaling doesn’t give any help in this, so I made to empty game objects and put them on the edges of two squares to measure the distance between them.
But this solution does not look nice. If I increase the size of the plane, then I have to move these “ancors” too. Also this is not 100% accurate…

Has anyone a better solution?
Thx for help :roll:

Hey. As no one replied I think I didn’t explain good enough where my problem is. :wink:

So maybe this grafic may help me to explain the problem:

  • The red point is the camera I want to move.
  • The grey plane is where I want to move the camera on, where I unfortunatelly don’t know how large the plane is. It is a “plane” game object from the unity editor and it’s scaling is 10.0f, 1.0f, 10.0f.
  • The black lines on the plane show the tiled “grid texture” which divides the plane into squares.
  • The green and yellow dots are my empty game objects which I use for calculating how far I have to move the camera on the plane from one squar to another (which is inaccurate and not very usefull if I want to rescale the plane).

So…
Is there a possibility to get the edge vertices of the plane mesh? Or is there an easier way how I can get the length of one border of the plane mesh?

Another problem (which comes along with the other) is that unity does not give me the possibility to get the size of a mesh. Out of the scaling parameter I can’t compare the size of one mesh to another.

Maybe someone has a better solution for my problem?

Thx 4 help :slight_smile:

101747--3916--$problem_104.jpg