#Creating a rope as the grappling hook flies

5 messages · Page 1 of 1 (latest)

oblique wyvern
#

So, I have a player character who has a form that possesses a grappling hook / ninja rope ability similar to the ninja rope weapon in worms, except it collides with the terrain. I've done up the sprite of a segment of rope, and alternate a Rigidbody2D based scene with a PinJoint2D based scene, screenshots attached. Then I initialize the rope system to pin to the anchor on the player. Then I pin on the top of the rope segment, with the bottom of the rope segment receiving a pin. Then it's initialized, and I can just alternate adding on rope segments and pins, updating the anchor of the last pin to be the new rope segment, and the new rope segment the new attachment for the grappling hook head. It's all controlled by a set of coroutines using a timer and an enum. All the player has to do is call step() on the player's anchor script and it will step through the various states and make the rope do different things, whether it's on standby, extending, affixed, or retracting.

The problem is, it doesn't spawn the ropes. Or at least, it doesn't spawn them in the right position, despite my coding it that way. When I look at the remote scene there is a collection of like 3-4 pins and one rope segment, along with the grappling hook which flies in its parabola ok. I just need the chain to instantiate behind it as it goes.

oblique wyvern
#

Here's an updated attempt. Rewrote the initialization to allow for the use of markers I put into the player anchor, the rope segment, and the rope pin joint.

#

Now the rope pieces appear but they don't seem to be pinned right.

#

I'm now trying to pin a segment of the rope to the player while having the segment in a Node, to prevent parented movement. It wasn't working like that so I put the first pin node into a container with a transform on the player's body, but still nothing is acting like it's pinned. the nodes even have pins assigned when I pause the game.