Howdy, I stumbled upon this thread a couple days ago while working on my own grapple/swing mechanic. I went through many of the same steps before moving a different direction. I’ve got something that works fairly well I think (for a prototype at least). Still lots of improvements and some bugs to work out (most notably, there are gimbal lock issues when adjusting your momentum while swinging).
Here are the basics:
- Fire grapple out where it can latch onto a surface.
- You can pull yourself to the latch point.
- You can swing from the latch point if you jump or fall off an edge (assuming you have room to swing).
- If you come in contact with the ground while swinging you will unlatch.
It’s still early so there may be some pitfalls. But if nothing else I think my technique could help you figure out if your grapple game concept is interesting enough to pursue further.
Technical basics of grapple mechanic:
- Ray trace to find latch point.
- When swinging commences compute idealized pendulum movement and move player to “follow” this pendulum. This has the added benefit of preserving collisions for the player so you can deal with them as needed (stop swinging if you bump into something)
- Add buttons to lengthen or shorten the grapple cable or change the angle of swing. Simply updates the values in the equations used to compute the position of the idealized pendulum your player is following. NOTE: I haven’t solved some gimbal lock issues with this yet.
- You can pull yourself towards the grapple point which just pauses the pendulum swinging and moves you quickly towards the latch point.
There is a decent bit of 3D math involved to accomplish all of this. But it’s not overwhelming. I’ve done all of this with blueprints though it’s probably debatable whether or not I should have done more in C++. The math in particular is way less messy in C++.
If you’re interested in the project I could probably pack up the files or something. I’ll check in on the thread every now and again just in case. And you can always PM me.