Posted December 16, 2019 by jacobsmith3204
#2d climbing
so to do the climbing I had to approach it in multiple stages.
first throwing the rope. add force to each segment of the rope; the rope being a line renderer attached to ribs with springs joints connecting them, forming a line. sets a bool to allow the tip of the rope to search for collisions, the bool is set false either when the rope starts falling again or it hits something.
I raycast upward to make sure that there is a collider directly above the player. sticks the rope to the collision and then allow the player to climb up the rope. moving it through the segments at a fixed speed. when it gets to the top I disable the collisions and I raycast find the top of the collider. then
I move the player from where the first raycast was up to the new one. and move the player in the same way I did for the rope climbing to scale from the bottom of the asteroids.
I used the animator to help match the poses with an animation event triggering the last segment which is just an animation of the guy I made at 2x the height allowing for me set the position in the middle rather than the bottom of the sprite giving a seamless animation, from one state to the next
then I move the rope back up and reset everything back to their original states.