Part type pairing
Over the past few weeks I’ve totally reworked the system that decides which types of parts can be attached to other parts. Previously there was a predefined list that explicitly specified the legal pairings between the various part types, including which set of attachment points to use, and what attachment types to allow (e.g. fixed, rotating, sliding etc.) This made it awkward to add new part types. When adding a new part type, you had to make sure any existing part types that you wanted to connect to it be updated too, essentially meaning the list would grow exponentially the more types you added. Unwieldy now, totally unworkable in the future.
So I scrapped the predefined list, and now legal part pairing is determined implicitly, simply by what attachment points each part exposes. For example, if a part has at least one fixed surface attachment point, it will attach to any other part that has a matching fixed surface attachment point (an example being a block attaching to another block). This opens up the possibility of parts now being able to attach together that previously couldn’t because a pairing relationship happened not to be explicitly specified.
This task took a bit longer than I was expecting because it exposed some workarounds that were relying on the old explicit part type pairing. I managed to get around most of these, but there’s one I still need to go back and address properly.
New attachment types
The attachment types have been renamed (”rigid” to “fixed”, “hinge” to “rotary bearing”, and “slider” to “linear bearing”). In addition there’s a new attachment type: “linear rotary bearing”, this allows parts to slide relative to each other along the sliding direction, and rotate relative to each other at the same time.
Axles can now be attached to blocks with the “linear bearing” and “linear rotary bearing” types (as well as “fixed” and “rotary”, as before). Gears can now be attached to axles with the “rotary” type (as well as “fixed”, as before).
Construction controls changes
Finally, there have been some tweaks to the controls. In the builder tool mode, pressing Q while highlighting a part now clones that part. In the painter tool mode, right click now removes paint from the highlighted part, and Q now samples the paint colour from the highlighted part.
Next up
As previously mentioned, I need to revisit a hack / workaround that was relying on the old explicit part type pairing system. This all ties into how I use physics collider contacts to determine which of a part’s attachment points to use, a method I’ve never been completely satisfied with. So a big task coming up will be to investigate into perhaps finding a better way of doing this.
Also, I want to revisit the Unity 5 upgrade, and see if the recent Unity updates have helped with any of the long standing physics issues I’ve had with it. I’m not expecting anything, but you never know…
I also plan to start adding some new parts that will take advantage of the new part pairing system I’ve just put in place!