January 3, 2024

zomg cables!

I’ve put this off long enough. No more excuses. Let’s have some proper cables.

I’ve had my eye on Unreal’s cable components as a potential solution to my need for cables. Implementing them turns out to be pretty easy but, uhhh:

Needs more gravity? Eventually, I figure out a good combination of amount of stiffness and number of segments and, rather than gravity, a direction of force relative to the two ports the cable is connected to to make the cable billow out in a realistic way. I also implement a timer system so I’m only doing any expensive simulation while a cable is being manipulated and for a second or so afterward, after which the cable sleeps.

Not sure where all my textures went, but this is looking ok.

Using the same set of colors Rack uses for cables.

In the end, the work here necessitates a pretty major refactor of the cable class. It was originally implemented in a very naive way, and only really existed to draw a line between two ports. I rewrite it to treat it like the first-class citizen it is, making working with cables much more intuitive in general, and paving the way for doing something that Rack cannot: letting unconnected cables dangle in mid-air instead of just disappearing them when you let go. That’s not in place just yet, but it will be soon.