Builder Prototype - Unity
Roles: Programmer
Project: Prototype
Length: December 2014 – January 2015
Snap Shot: This was a collaboration project with another game creator. My role was as a programmer and this is the builder prototype that I created in Unity.
Showing a foundation block while editing it’s pins and the block database on the right side which holds all the block information.
Overview
One of the features we wanted designed was a construction system. So I went on to develop a system for creating building blocks to snap together. What I came up with is my 'Pin' system. There are pins that can then hook onto other pins, but not all pins have to hook, some can be just passive. Originally the pins were empty game objects but to increase performance they were changed to virtual coded points. Since the pins were no longer game objects I needed to create an editor extension to see and manipulate them. The graphical handles work like normal Unity handles and can vertex snap. I also added a helper tool that helps center a pin between two points.
Features
When a pin hooks it needs a cast direction. This is a raycast that checks for other blocks when building. Because usually a cast is perpendicular to a face of a model I made a short cut that when a pin is selected you can hover the mouse over a face a model (and it can be any model face, not only the one the pin is on) and press the shortcut key and it will make the cast direction the same as the selected face’s normal.
The building supports auto-snapping which just takes the normal of the face snapping to and rotates to it. But this only works for certain regular objects ( like the foundations blocks ).
Additionally one can set a default rotation direction for an object to snap to and on the snapping object a follow direction can also be set. This is used with the walls.
Editor Tool Demo
Here is a video showing how the editor works with setting up pins on a foundation block.
The foundation block being created can be attached to other foundation blocks on the same level. Pillars can be attached at the corners. Walls attach on the edges but need a default rotation set, and ramps (stairs) can be attached on the center of the top.
The demo shows of the editor menu, the custom handles to show the pins/hooks, and how the centering tools works.