Playable build – updated
New rack gear added
I’ve just added a rack gear to the game, useful for rack and pinion steering among many other things. Rack gears engage with spur gears that are positioned directly above them.
The implementation is still preliminary and still needs a bit of refactoring / cleanup, but it seems to work well so far, which is a relief. It looks like my gear physics solution is holding up!
There is one significant issue remaining with gears generally however, which applies to all gear types but is particularly highlighted by rack gears. Whenever a construction is modified (by adding or removing a part), a search is performed to find pairs of gears that are next to one another and should be considered engaged, and then a physics constraint is set up between each pair. However this is done only once, after the construction is unfrozen and things start moving about, the gear engagement pairings are not updated. Obviously this becomes a problem if the gears move apart from one another, it also won’t engage gears that start off apart, but then move together.
So I think my next big task will be to overhaul the gear engagement system so that it updates dynamically. It will need to be reliable, and not incur a big performance cost doing lots of spatial searches etc. could be tricky!