Search Unity

Adding objects into level

Discussion in 'World Building' started by xrm0, Sep 18, 2018.

  1. xrm0

    xrm0

    Joined:
    Feb 26, 2013
    Posts:
    86
    I'm building a small level which has a golf course.
    Up until now, I'm creating the level in one blender file and importing it in Unity.
    But, as I begin to need some things to be separate gameobjects I'm having difficulties in deciding how to proceed.
    Here you can see the golf course and the hole is where the axis is located.
    Screen Shot 2018-09-18 at 07.46.39.png

    The hole gameobject:
    Screen Shot 2018-09-18 at 07.51.30.png

    In this case, I see two options and as I'm a noob-level-builder I would like to hear from more experienced people on what's better:
    • Cut a hole in the level mesh (in Blender) to place the hole gameobject in Unity.
    • Merge the hole mesh into the level (in Blender) and in Unity add an empty object at that position with the needed scripts/colliders/etc
    • ?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,686
    The way I did this for my golf courses is to use the Blender3D boolean modifier to cut out the holes in Blender. That way the golf course surface can be all one contiguous mesh.

    See the enclosed .blend file for a golf course with two boolean-cut "live" holes in it, one by a straight cylinder and one by a bevelled cylinder.

    Note that I put separate materials on each object (golf course, straight cutter, bevelled cutter), and that I unwrapped all objects fully (just a simple smart unwrap), and finally: I put ALL THREE materials on the course itself, such that when the boolean tool cuts it out, it "paints" the other materials inside the holes.

    You can do it all with one material too, but at least the above kinda gives you some flexibility. I colored the materials in Blender but I always reassign new materials in Unity so I can control it more precisely, adjust the shader, etc.

    Also, after importing it into Unity3D, you have to disable the cutters, as they will be solid geometry that is no longer needed. I leave them in the Blender file so you can move them around (in blender) and adjust the precise position of your holes.

    Try to avoid renaming the blender object names AFTER you first name them and Unity reimports them, since they will become fresh objects to Unity and your prefabs will get all conflustercated.

    I leave it to you to import the objects, put colliders on it, stick sensors (triggers or what have you) and so on.

    Note also I made the golf course itself not flat but rather a volume. If you make it flat then the Boolean tool might not cut quite the way you expect it. I also hide the cutters in the .blend file too so you can see them by quick render in Blender.

    Here is a quick render from Blender:

    20180918_golf_hole_cutters.png
     

    Attached Files:

    Last edited: Sep 19, 2018
    xrm0 likes this.
  3. xrm0

    xrm0

    Joined:
    Feb 26, 2013
    Posts:
    86
    Thanks @Kurt-Dekker! I'll take a look at the blend file.
    Yesterday I started doing something like you say, using the knife to cut a hole in the mesh and joining the "holes" to the terrain. And then in Unity adding some colliders and triggers to detect the ball.
     
  4. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    It looks like the geometry is fairly simple, so you might have a better time building this in-Unity, with something like ProBuilder. Like the GIF below, then you could tweak the size/position, add new holes, etc, without leaving Unity. Makes iteration and testing ideas much faster :)

    Golf-VerySmall.gif
     
    bolkay, xrm0 and Kurt-Dekker like this.
  5. xrm0

    xrm0

    Joined:
    Feb 26, 2013
    Posts:
    86
    ProBuilder is something I have on my wanting-to-try list, maybe it's time to do it. Thanks @gabrielw_unity!
     
    gabrielw_unity likes this.
  6. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Sure! Feel free to ask if you have any questions :)