#Set a grappling hook that bend when balancing ?

8 messages · Page 1 of 1 (latest)

gray torrent
#

I would like to make a grappling hook, like an elastic pendulum. I'd like the elastic rope that serves as the grapple to bend if it encounters an obstacle (rigid body) in its path when there is the balancing movement. In short, I'd like to replicate the grappling hook design in this video (Tom Francis - Floating Point): https://www.youtube.com/watch?v=voQweyYFHrg&list=PLUtKzyIe0aB1WkP0OEe7OLi0Ynh_CjRM9&index=10

The physics should be fine, but for the grapple/rope I don't know which node to use, in particular for the bending aspect. Any suggestions ?

gray torrent
#

For the bending interaction, here is another video showing it at 0:17 https://youtu.be/Krlf1XnzZGc?t=17

I'm working on the grappling hook game again now, and I've got the rope wrapping nicely around things, going slack when it should, and even making sounds. In this video I show you how that looks, then - with fair warning - get into how the code works.

Sounds from freesound.org
Retract noise: eelke
Grapple impact noise: taylorsyoung

▶ Play video
eager salmon
#

I would use a Line2D, initially with only two points at the start and end. Then check along the Line2D with a RayCast2D from the first point (player position) to the next point (grappling fix point) and if it hits something add an intermediate point to the Line2D there, fire another RayCast2D from that point towards the next point and so on. The player would swing from the penultimate point in the Line2D. In subsequent frames you would also have to check from the first point to the point two positions before it with a RayCast2D to see if the penultimate point was still needed and if not delete it and so on until you got back to the last point. I think that would work as long as the points the line wapped around were static.

#

Thinking about it, it might be hard to get the detected line wrapping points to exactly hit the corners of the platforms. If the platforms were on a regular grid you could cheat a bit and snap the new points to the nearest corner position.

#

Another way to check which points could be removed from the Line2D would be to iterate through its segments and if they have the same aspect as the previous segment delete the first point of the segment you are checking.

gray torrent
#

Very interesting, I think I will try too implement it this way

gray torrent
eager salmon
#

It depends how far the grappling line moves each frame. The RayCast2D may give a collision point further down the side of the platform than the exact corner where you actually want to place the breaking point in the grappling line.