- Home /
how do i create a "randomized infinite grid"? details here..
im new to anything scripting, so i need "extra explanations" to what your answers and solutions are! help me learn so i can apply and grow as an artist too =)!
i am trying to create an infinite "grid" if you may..i already roughly know how "it should work" but, i have not much idea how to actually write it.
i have 3 tiles...modeled in Maya, so they're assets now..named as such in unity and tagged as Tile.
-floorLF -floorMd -floorRT
i want to lay them out, in rows, in those 3 columns (left, mid, right)...in the Z axis.
now how can i make Unity "instantiate", i think thats the technique used here, these 3 tiles over and over, like below:
[x][x][x]
[x][x][x]
[x][x][x]
[x][x][x]
[x][x][x]
[x][x][x]
and i want this to never end basically..when it scrolls in the Z axis and "reaches the end", another set of the 3 tiles will be "Spawned" to create this infinity. i think somewhat like a 3column x 20rows would be great for what im trying to achieve...so "row21" wouldnt be there but when we scroll/travel/reach row15 or something near the "end", the new row21 would be craeted..and row1 would be "invisible/removed".
if there's any direct tutorials that can show me how to do this, that willbe great too. the unifywiki has nothing, answers.unity has nothing useful for my level of knowledge either..the 3dLerpztutorial and 2dtutorial didn't really help me find what i need either..and itween doesnt help me much either..key is i wanna learn and understand the code that will be written for this.
so thnks to anyone that can help me build, and teach me, what i need to do, showing me now is great, but i want explanation so i can further apply it to other tasks ahead, thanksthanksthanksthankss!!
i'm writing in C#. no js please!! well js is fine i guess, but then i'll need someone to help me change it to C# since my other scripts i wrote already in C#.
i found some suggestions relating to setting up Application.LoadLevel or something like that, as well as creating a "treadmill" solution, but nothing that really helps me see how its done, Unity Scripting Reference doesn't really help me understand much either for my level of knowledge and experience with code.
Answer by Peter G · Jan 30, 2011 at 03:44 PM
I believe that the Locamotion demo has a scene that does something similar to what you want. The character can walk in either direction and when he/she gets to a certain point, it deletes the last tiles and spawns new ones.
http://unity3d.com/support/resources/unity-extensions/locomotion-ik
this resource was excellent. i wouldn't have expected to find this system inside a "locomotion" demo..i saw it a long time ago while searching for tutorials on my own, but completely ignored this package because i assumed it dealt with only character locomotion/animation which wasnt in any way relatd to my problem!!
thanks for pointing this out Peter!
now to break down his script and see what i need and can do with it for my own purpose..
(and is there anyway i can pm you or chat with u privately? lol)
I'm on the forums as the same name pm me there if you can, or email me. I'll post that if the first way doesn't work.
Answer by Jesse Anders · Jan 30, 2011 at 03:19 PM
the unifywiki has nothing, answers.unity has nothing useful for my level of knowledge either..the 3dLerpztutorial and 2dtutorial didn't really help me find what i need either
This isn't the sort of thing you're likely to find covered on the Wiki or in a tutorial.
Although your question is fairly clear, IMO, there's not enough information there for us to make specific suggestions. The problem is that there are many ways what you describe could be done, and which method to choose depends on gameplay mechanics and other parameters.
That said, a simple solution would be to make the array 'tall' enough that there will always be tiles visible, and then continuously move (in a loop) the tiles down or the camera up. If you set it up right, this should give the effect of continuous scrolling.
Again though, depending on the game mechanics, another solution may be needed.
i know that there's many ways to achieve what i described above, it's just i have no idea what to even try yet, not sure where to begin, i don't even know how to write an array, even though i already knew it would be some sort of an array/matrix... =\
Your answer
Follow this Question
Related Questions
How to check whether gameObject is on even ground? 1 Answer
How to apply more than one trigger on a single gamebject 1 Answer
2D Tile Map Question 0 Answers
Grid Movement VS Free Movement 1 Answer