This is meant to be short and isn't a Blender or Unity3D tutorial of any sort. Though I might go more in depth later if there's a demand for it.
Also, keep in mind none of these images contain final art and are mostly placeholders while we programmers are still figuring things out.
Here we goFirst we make a level segment: some geometry for the player to see and some collision meshes.
|The actual mesh we see and it's collision mesh, shown in wireframe|
We make sure to add "_collision" to the collision meshs' name. I'll explain this in more detail later on.
|_collision just means the mesh is just a collision and should not be rendered.|
We then put both types of geometry into the same group. Usually we use the file's name for consistency's sake.
We then create a level.blend file which appends (links) the groups in the other files as building blocks to create the level.
Tip: if you hide a mesh in it's original file, it will stay hidden after you import it. Very useful if you don't want to see your collision meshes while previewing the level here.
|Two LongCorridors making up a longer corridor|
Now we just import level.blend directly on our Unity scenes and all the meshes linked in it are correctly presented in our level. However, we have no collision yet - adding it manually would be a lot of work for levels of even smaller sizes.
A custom script, extended from AssetPostprocessor checks if we're importing a "level" file. We then go through every GameObject that we imported and check if it's name contains "_collision" - in which case we remove it's renderer and create a mesh collider for it using it's own mesh.
Another option we have so far is "_canhide", which adds a box collider to the mesh and configures it in such a way that it can be hidden if it obstructs the player's view.
We then use the Unity3D editor to add waypoints (paths our characters follow during gameplay), along with other extras we didn't import from the blender file and we're set.
|Voilà, a complete placeholder level|
IssuesHere's some concerns we have with this method:
- Waypoints have to be setup after importing the level. We should find a way to automate this as it get's very annoying to update huge clusters of waypoints after even slight changes to level layout.
- The same is valid for enemies, player start position, checkpoints, lighting and other non-geometry objects
- Having the level split up in "blocks", each with their own collision meshes might make the game suffer performance wise.
Note: We disabled importing of animations for the level file, as unity has some issues with Default takes on Blender.
Post a Comment