- Home /
can anyone tell me about making grid manualy
Hi, I am creating one application for android device like making interior design, In that i want some tool like grid that for designing and i can calculate the dimension also please help me about this. Is there any way to create the grid layout please give me answer. I have one texture Grid, that placed on plane but how can i find exact location of coordinate.
I don't understand your question. If you are talking about getting world coordinates of a mouse position, you can use Camera.ScreenToWorldPoint(). Be sure to set the 'Z' parameter of the Vector3 passed to the distance between your camera an your plane.
thanks for reply me. $$anonymous$$y question is how we find the particular grid point? that user can click only on plus sign of the grid. This grid contain tiling 100 * 100. $$anonymous$$eans I want to make clickable on only coordinate of the cell.
Answer by markedagain · Jul 12, 2013 at 05:00 AM
ok, i wish it was as simple as you would hoped.
there are many ways to do it, but prob the simplest i can think of is , you create a single plane and this plane is 1 of your squares of the grid , u make a prefab out of it, then u simply create it 20 times by 20 times. manually speaking this will take for every, so a small script with 2 loops should do the trick.
i believe there is a few "grid" assets on the asset store but i think they are paid, but i beleive they employ the same system of cloning each little square.
once the square form a grid ( your square should be textured with borders ) u can put OnMouse event onto a script attached to the prefab. like this each tile will know when the mouse is over it.
Answer by robertbu · Jul 12, 2013 at 05:01 AM
This is just a calculation problem. Lets say that the grid as 100 x 100 squares which means, including the edges, it has 101 lines. So to make things easy, make the plane 100 units by 100 units. If you are using the build-in plane, then scale it to 10 x 10 (since its default size when at (1,1,1) is 10 x 10). If you are using the CreatePlane editor script, you can just size it to 100 x 100. After resizing move the camera and/or adjust the field of view. Now all the coordinates will be whole numbers...easy to calculate and easy to find the nearest one if required. You could position the plane so that the bottom left corner is at the origin. This would make world coordinates and the coordinates of the intersections the same. If you set the center of the plane at the origin, you will need to offset coordinates by 1/2 the plane width. Note the mouse lives in Screen space, so you will need to use Camera.ScreenToWorldPoint() to find the World coordinate of your plane.
ya it took me a few seconds to realize what he asked, this is the catch " I have one texture Grid, that placed on plane"
im thinking with 1 plane, he can always use screen to world coord to get exact spot then create a box there of some sort, but figure actually making a grid is better step to learn first
Thank you very much all of you for replied me. I will try this out.
Your answer
Follow this Question
Related Questions
Size To Grid with Walls 0 Answers
I need a grid to help me model and design things. 4 Answers
What is the best way to create 3D tile based levels in Unity ? 1 Answer
Dynamic Grid - A design problem. 0 Answers
Transform does not move GameObject 1 Answer