Search Unity

Basic Idea

Discussion in 'Immediate Mode GUI (IMGUI)' started by Jeromeyers, Feb 3, 2015.

  1. Jeromeyers

    Jeromeyers

    Joined:
    Feb 1, 2015
    Posts:
    4
    I'm totally new to Unity and 3D modeling. I come from a programming background. As such, I tend to think of overly complicated solutions to problems in the name of simplification. That said, I have a question.

    As soon as I was faced with a blank textured plane that I wanted to populate with a bunch of rocks and trees I was faced with where to get them. I could buy them. I could make them individually. What I'm really interested in, leveraging my skill set and interests, is in procedurally generating them. I'd like to plop an endless variety of them down out of the air, so to speak, onto my terrain. That in itself would be a fun sort of game.

    Ideally, I'd create a Unity extension that offered a bunch of parameter ranges, and allowed for the generation of terrain objects. Is this feasible?

    I see two spheres of knowledge: procedural generation of 3D objects and Unity GUI extensions. The second aspect seems like the more straightforward of the two. Can anyone point me in a good direction for either? Thanks!
     
    Last edited: Feb 3, 2015
  2. HenryStrattonFW

    HenryStrattonFW

    Joined:
    Jul 27, 2012
    Posts:
    18
    Yes this is entirely possible to do.
    You can start on the procedural side of things at any time, you can set up a MonoBehaviour with the parameters exposed for the inspector, and then have the procedural mesh generate in the awake or the start. You'd just need to ensure the object has a Mesh Filter, and a Mesh Renderer then you can generate a Mesh object, populate all the date for verts, triangles, normals etc. and then set that mesh to the filter. The unity docs might be a good starting point for procedural mesh generation. http://docs.unity3d.com/Manual/GeneratingMeshGeometryProcedurally.html

    As for the editor side, again, very possible. You can easily build a custom editor window with a panel for the properties settings and controls, and a panel to preview the mesh before creating the object in the scene. Again a good place to start with this is the unity docs, they have a set of introduction docs for extending the editor in various ways (inspectors, windows, and property drawers) In this scenario you would probably be looking at a custom EditorWindow
    http://docs.unity3d.com/Manual/editor-EditorWindows.html