I didn't make it! Sam Morrison programmed that, but if i had to guess:
- raycast to each hook within range, choose the closest one, sorting by players look direction
- from there you basically constrain the player to not move any further away from the grapplehook, but keep his momentum, and add a math function to interpolate, somehow giving it a springy feel
- draw a line between the two to make it look like a grapplinghook
- we were also going to smooth-rotate the player sprite so that his head faces the grapple-point, to make it look more like he is swinging
You could probably google and find an answer much better than this!