- Home /
game grid generating whle in camera view ? 3d game scene) android
I want to make a grid similar to these pictures:
How would i dynamically generate this grid at a certain z (vertical) level? I want to use a texture, unless i can generate it using raycast as different colors and thicknesses (probably using more rays). This is for a 3d scene app for android if that matters.
whats the plan with the result? just a drawing or is it supposed to move/rotate around? it matters when you choose your solution for this.
What do you mean by dynamically generate?
If you want to create a grid of a certain size you could instantiate it at the needed z level.
i would create a plane with the size of one meter representing one cell of the grid - than scale it and increase the tiling of the material the fit the scale...
hope this helps a bit
Answer by BerggreenDK · Nov 02, 2011 at 08:50 PM
First, the grid. Without amazing colors.
Just draw a grid square in a texture. Then TILE it onto a flat surface. If you use a flat ground, then you can rotate it as you please.
If you need to move the grid, you can either move the ground the same amount as the gridsize and then reset the position OR index into the texture/material itself and add directly to the UV map coords.
The colors could be made with another texture multiplied/added into the same shader.
Answer by 1337GameDev · Nov 02, 2011 at 10:24 PM
I meant dynamically created as in a non-static game object, because i thought that might eat up resources and would be hard to scale and etc.
A dynamically created item only draws what is in view and creates the desired shape or etc using a function or repeating pattern of code. If i do this i am not sure how to get it to only draw within my camera view (camera can move and rotate) and how to get it to not move with the camera (if i do something based on camera position to get it to only draw in camera fov)
Answer by BerggreenDK · Nov 02, 2011 at 11:05 PM
2 things:
1) this forum works different than normal forums. you only post Answers if they solve the Question asked or expect/think they will. You can cut/paste your previous answer to your own question (which you can modify/edit)
2) If you use 1 plane with 2 triangles and a mapped texture that has a tiled grid, I dont see how this would eat that many resources? in Unity a camera has a distance it will look. if you keep your groundplane around center of the camera then you will have an endless grid (search for tilebased scrolling on Google) or how to use viewports.
Answer by rajavamsidhar_gvs · Jun 16, 2015 at 05:38 AM
u can draw with script also..u can get the script in unity3d forum link is
**http://answers.unity3d.com/questions/482128/draw-grid-lines-in-game-view.html**
it will help u..
Your answer
Follow this Question
Related Questions
Move along grid where facing 1 Answer
Best way to dynamically generate textures? 0 Answers
Setting camera target after I instantiate the gameobject? 2 Answers
Dynamic Camera Help 1 Answer
Dynamic terrain loading on one scene 0 Answers