Hello everyone! I would love to add a grappling hook to my game but I have no idea on where to start. There does not seem to be ANY tutorials anywhere on making a 3D grappling hook. I found this thread but it's 6 years old and after testing it it does not seem to work anymore. Does anybody know about or have a working 3D Grappling hook script? If not, can we create one together? Cheers!
What kind of grappling hook? The kind you look at a point, click to use and it just drags you towards that point... or something more complex?
If not too hard, I would love to be able to use it as a rope with physics and when I press RMB it drags me towards the anchor point.. But I would have to start somewhere, so a click and drag system would be more than good enough for now!
I think the best method to do this would be have mouse click while in hook mode add velocity on hook in the direction of click using camera.main.screenpointtoray. if it hits a collider with an acceptable tag (layer mask)(wall to hook on), then set grapple hook velocity to 0 to stop it in its tracks and apply the same velocity to your attached player to repel him towards the hook. i have no pre made example sorry
You could make an object which has a pivot at the top of the hook as a sensor , make a box collider on the hook sensor (maybe use a flat plane as sensor) and then make it so when the box collides with whatever you want to hook to the hooks new position is the hookspot. thats how I'd do it, you may want to use a raycast as well...
Wouldn't raycast shoot the hook instantly? It would be cool to make the effect of the hook going through the air. To see it fly through the air.
Thatd probably be done with an animation then and obviously the grip could only be used from a distance because of the animation being a certain amount of time. I think not sure, wouldn't dare try make one, id fail haha I just kinda understand how you'd do it.
Ok, so I'm now shooting the prefab, it has a tail renderer (I don't know if this is the best way to draw a line between the player and the hook) and it sticks to what it hits. Still don't really now how to drag the player towards the hook..