I’ve been working on creating a grappling hook device, that could be used by players to throw onto higher ledges and then climb up with. Unlike the “standard” game grappling hooks used by the likes of batman and that just cause 2 dude I can never remember the name of, I’ve been trying to create more of a portable ladder that somewhat forms itself around simple geometry than a thing that pulls the character to a point on a wall. With the first few attempts I experimented with skeletal meshes of ropes, which I only ever managed to horribly glitch out at the slightest movements. Then I’ve tried to use the cable components attached to two physics objects with a physics constraint between them, but the cables do not have collisions, so I’ve been trying to find a way to form them around corners using multiple cables attached to each other.
So far I’ve managed to get it to work almost like I want them to under strict laboratory like conditions. Here’s some screenshots, where I’ve turned the cable component length to 1 and the segments down to make it stop falling into the floor just so I can see them better for now.
Basically what I’ve done so far is trying to find the shortest path over any obstacles between the two objects. First checking whether there’s straight line of sight between the objects, then if not, check if there’s a trace possible between them at the higher object’s Z value, if still not, increasing the Z of both until a trace was possible. Then using some of the trace hit locations and normals to determine and place the points of rope around the object corners. Because I’ve only got one hard constraint between the objects and not the rope itself, it could in theory go over an infinitely high wall if both objects were dropped on opposite sides, so I added a force that pulls both objects towards each other or the centre point when the rope length exceeds the maximum desired length. Which lets me keep a relatively consistent length around things and pull one end and have the other one move along the line of the rope. I’ve also added a capsule component along the rope that scales with the length of the rope that I can use for some kind of ascending/descending mechanics, which I haven’t done yet.
It’s super buggy and easy to exploit by just throwing one object behind a wall or around a corner and having a rope magically appear on the top of it or how to make sure that it goes around an edge with overhangs and not through floors, as well as maybe adding more break points to better fit on more complex geometry. So I’m really just posting this to see if anyone has any clever ideas about how to approach something like this or has a better solution entirely.
Ah yes and I’m doing this entirely in blueprints, because I still haven’t learned C++ enough to deal with any kind of real problems with it.