In addition to building art content for the cylinder head I have been working on improving the systems for part assembly and I have begun building the fastener object class so that I can start implementing tools.
For my assembly systems I have been working on a flexible way to allow a single part to be installed in multiple locations. This will be used for most fasteners but there are also many other parts that should install into many locations. I had a simple system in the prototype video but it wasn’t flexible to cover all use cases and this new system is much more robust. The trick to making a single part snap to multiple locations is both setting is both doing the actual part snap, and making sure you have a system to correctly store bools in order to run logic around install status. I’m using Unreal’s socket system to snap parts together- A socket is just a transform, there is no way to query a socket and see if it is occupied. If every single part in an assembly is unique and can only be installed in one location, you can simply make a bool for each socket, and then set the corresponding bool when a part is installed or removed. If you don’t actually know what object or what location on an object a part was installed, managing the bools becomes more challenging.
The solution I have come up with is using an intermediary Child Actor Component (CAC) any time I want one part to attach to many locations. A CAC is an instance of a blueprint that is spawned as a child object at run time. In my use case, each CAC is just a null static mesh (cube with visibility turned off) that has a socket I can snap to, and a single bool to indicate if that CAC slot is occupied. In this example, the hub object can snap to either the left or right uprights. The hub is actually snapping to the CAC object that each upright contains. The hub doesn’t need to communicate with the upright- On install/removal it only changes the bool on the CAC (called MultiBool). The upright is then responsible for checking the CAC, reading the status of MultiBool, and then settings its own hub installation bool to match MultiBool on the CAC. I’m checking the CAC for it’s bool status once every .5 seconds, I could probably make the check even less often since that bool isn’t actually used by the hub for it’s install or removal logic.
Here is a video of the wheel studs, front hub, and uprights all using this system:
I have been prototyping the fastener object class. The fastener object class is a subclass of the main snap part class with a bunch of added information:
Int: Fastener head size. Used to automatically swap sockets or wrench sizes to fit the fastener
Float: Fastener length
Float: Fastener thread pitch
Float: Major Diameter
Bool: Is torque critical fastener?
Float: Target clamping force
The art for every fastener in Wrench is accurate down to the thread pitch. I keep notes when I build fasteners so I know the dimensions. By including this data in each game object I can do a bunch of interesting things. First, I can make the visual representation of tightening from loose to finger tight appear accurate. If I know both the thread pitch the bolt can be moved inwards the correct amount per degree of turn added- This will make the number of turns to reach finger tight accurate. After the fastener is finger tight I can simulate an accurate clamping force based on how many degrees it is turned past finger tight, bolt length, thread pitch, and major diameter. That calculation can be re-purposed into torque wrench settings or bolt stretch gauge readings. Most fasteners in the game will not be torque critical, but they will all generate and store a torque value. I’m not planning to penalize the player for over/under torquing non critical fasteners but I can flag important fasteners (every internal engine bolt, lug nut torque, axle nut…) with the bool to see if it is torque critical and then penalize the player appropriately.
Recently finished art for the cylinder head fasteners: