#Grappling hook

1 messages · Page 1 of 1 (latest)

junior meteor
#

Hey, i want to create a grappling hook where the player shoots the grappling hook, and the grappler hooks to a block closest to the mouse, however all the tutorials i see just hook the grappling hook to wherever the mouse is, by the way its 2d

fluid bridge
junior meteor
#

no like, you know the grappling hook, i can do the whole thing all i want is that the hook dont go where the mouse is but to the closest solid gameobject

carmine pilot
#

Use OverlapCircleAll to get all suitable objects within a reasonable distance from the mouse, then pick the closest one from that list. But it might make for better gameplay if instead you check with a raycast if the grappling hook hits something wherever the mouse is, if not then change the raycast angle a little and try again, and keep going on both sides until it hits something