Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
1
Question by Leprekhaun · May 18, 2014 at 07:26 AM · terrain generationrandomize

How do I generate this type of terrain randomly on runtime?

Hi there! does anyone know how I should go about creating similar terrain like in the first image and inverted so that the majority of the map stays flat except for the map edges (lead into ocean) and create rivers and lakes? Also how would I make it randomly generate per new game? I'm new to Unity so I'm not sure what to look up for specifics on this topic. Thank you for reading and hopefully enlighten me on this since it will greatly improve progress on my game.

alt text

tutorial01.png (93.2 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by fafase · May 18, 2014 at 07:42 AM

First it would be easier if you would use a square plane, sure it would add some triangles but it would not change the visual aspect since the edges are meant to be underwater.

But in order to find the edge vertices, a polygon is more complex. In a plane, you would have to create a method iterating through the mesh and finding the vertices with min x, min y, max x and max y. If a vertex contains one of those, he is an edge vertex.

 void Start(){
     Vector3[] edgeVertex = GetEdgeVertex();
     // Run your method to shape the plane
     // Discard action on the vertices containes in the list.
 }
 Vector3 []GetEdgeVertex()
 {
     List<Vector3>list = new List<Vector3>();
     Mesh mesh = GetComponent<MeshFilter>().mesh;
     foreach(Vector3 v in mesh.vertices){
        // if the vertex is on the edge, add it to the list
        if(v.x == minX||v.x == maxX||v.z==minY||v.z==maxZ)
            list.Add(v);
     }
     return list.ToArray();
 }

I am quite doing this by head so this may give you a lead but may not be fully working...

Comment
Add comment · Show 3 · Share
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 Leprekhaun · May 18, 2014 at 09:20 AM 0
Share

my goal is to have a couple layers visible before it goes into water that way you get depth but i will be sure to use this to go off of first thank you. id still like to know how to get that similar effect that is shown in the picture

avatar image fafase · May 18, 2014 at 09:22 AM 0
Share

What effect? If you want to have some distance from the edge just get the edge guys and compare the position of the vertex you are dealing with and if that distance is greater then apply a y value to the vertex. Then you get relief.

avatar image Cherno · May 18, 2014 at 03:54 PM 0
Share

You would probably want to look into using heightmaps to control the topography of your terrain with a simple grayscale image.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 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 avatar image

Related Questions

How do i tell what gameobject im on 1 Answer

How to create “broken glass” animation? 0 Answers

Instantiated objects not appearing in scene or game view 2 Answers

How can I use feature recognition on terrain? 1 Answer

Terrain Destruction(crater) 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