Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jul 20, 2015 at 01:44 PM by Qo2770 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Qo2770 · Jul 11, 2015 at 01:01 PM · terrainvoxelchunks

Help with generating Chunks!

Hi, I am making a voxel, minecraft-style, but cannot figure out how to dynamically spawn chunks. Every tutorial I found was taking about spawning chunks from prefabs, but I am using PerlinNoise to generate the chunks into the world as the player moves.

This is my method for generating one chunk: void GenerateChunck(int xStart, int zStart) {

         ChunckSize = 16;
 
         xStarters.Add (xStart);
         zStarters.Add (zStart);
         xEndings.Add (xStart + ChunckSize);
         zEndings.Add (zStart + ChunckSize);
 
         for(int x = xStart; x <= xStart + ChunckSize; x++) {
             for(int z = zStart; z <= zStart + ChunckSize; z++) {
                 //Instantiate Grass based on size and parent it to TerrainManager
                 var instantiation = Instantiate(Grass, new Vector3(x, 0, z), Quaternion.identity) as GameObject;
                 
                 instantiation.transform.parent = transform;
                 
                 //PerlinNoise
                 
                 height = Mathf.PerlinNoise((x + seed) / scale, (z + seed) / scale);
                 
                 FinalY = Mathf.RoundToInt(height * scaleModifier);
                 
                 instantiation.transform.position = new Vector3(instantiation.transform.position.x, FinalY, instantiation.transform.position.z);
                 
                 GrassLocations.Add(instantiation.transform);
             }
         }
         
         //Generating all levels below grass
         GenerateDownward();
     }
 }

Any help would be appreciated!

-Qo2770

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Cherno · Jul 11, 2015 at 05:17 PM 1
Share

So, where is your problem? Using prefabs for chunks just means that you isntantiate a gameobject that has a $$anonymous$$eshRenderer, $$anonymous$$eshFilter and $$anonymous$$echCollider and then assign the texture atlas material to the Renderer, and the generated mesh to the Filter and Collider.

avatar image Qo2770 · Jul 12, 2015 at 12:38 PM 0
Share

Ohh, I understand. Thanks so much, I will look into it. Sorry for being so nooby, but I'm just learning Unity, -Qo2770

avatar image Cherno · Jul 12, 2015 at 04:00 PM 1
Share

We all have to start somewhere :)

Here is a handy, if comprehensive, thread for all things Unity-$$anonymous$$inecraft-related.

http://forum.unity3d.com/threads/after-playing-$$anonymous$$ecraft.63149/

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how to create chunks in voxel terrain generation 1 Answer

How to load stacking chunks on the fly? 1 Answer

Flowing water in my voxel terrain 1 Answer

Terrain Chunk loading 1 Answer

Tiled Terrain 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges