- Home /
The question is answered, right answer was accepted
I have no idea what to title this...
I am planning on making a city building game that uses a grid, and you click and place buildings on a plane which is on the same y as the grid (so it looks like it is lining up with that.) The problem is to do with the plane though. Some "buildings" like the subway station, and road, should go into the ground, rather than sit on top. For the subway station, the mesh goes through the plane.
So the question is, how do I make the plane underneath / through the subway station go "invisible" or delete?
If I made it a separate plane for each space, and then a raycast deletes that plane when the subway station is above it, it was use a lot of processing power to make every plane (4 vertices per plane, 500*500 city zone.) So how do I go about this?? any ideas are super useful, urgently need some sorta solution.... Thanks
sorry if I seem like a noob, I suppose I am really....
I'm not sure whether it is a good idea to,but the grid size for the game is 500 * 500. The only solution I can think of is to make each of those grid spaces a plane. So yes, there would be.
Answer by maccabbe · Mar 02, 2015 at 01:25 PM
The biggest problem with making a plane per grid space is that you will have 500*500 gameObjects so I would look up how to create meshes. You will probably want to separate the grid into chunks so you can temporarily hide things that you aren't using and make refreshing the mesh faster. I would look at a procedural generation tutorial. Here is the first part of a voxel tutorial that will show you how to create meshes and split space into chunks.
http://studentgamedev.blogspot.com/2013/08/unity-voxel-tutorial-part-1-generating.html
You can also reduce the number of faces if they are solid color using some of the techniques described at this tutorial http://0fps.net/2012/06/30/meshing-in-a-minecraft-game/
how would I make the mesh turn invisible when something needs to go below it though?? if they were separate meshes, you could delete them, and it would work but would take up a lot of processing power, and RA$$anonymous$$. so that's not really a good idea. I get what youre saying, but how would u make certain faces of the mesh turn invisible? and how would you detect if something needs to go through the mesh?
Ok, I've done a bit of research, thanks for the pointer!
Follow this Question
Related Questions
Why is raycast not working with mesh collider 0 Answers
Mesh Collider Issue(?) - Raycast (ScreenPointToRay) Appears to Collide on Nothing 0 Answers
Dynamic mesh positioning with Raycast intersection... 0 Answers
Mash Manipulation like in real world? 0 Answers
Raycast on mesh deformed by shader 0 Answers