Creating A Grappling Hook.

Had to ask because I don’t even know how to begin approaching this problem.

I want my character to fire a grappling hook that can attach itself to parts of the enviroment, then allow the character to pull itself up, or swing to reach new areas.

First thought is to the ITween functions, which would allow the grappler to tween itself to the target but to keep a rope attached, then I need to tween only one object, while the second object stays attached, but if I add a joint system, then it only moves via animations, which will not work when the distance can be variable…

I also need the grappler to fire off at the correct angle. Should angle based what side of the screen is clicked on, travel at a certain speed, detect a collission and change states upon impact.

All that stuff is reasonably easy but now to get the trail… maybe a particle that looks like a rope to follow. A vector3 line.

You can make a visible raycast for the rope, following a grappling hook object that is a rigidbody that’s shooting out. And for the attach part, you can make it so that if it collides with a wall, you can make the grappling hook “kinematic” by doing rigidbody.isKinematic = true;
And for dragging, you can always use my EnemyFollow script and modify it so that if the grappling hook is kinematic, you start moving towards it and when you are like 5 meters away the grappling hook removes itself and the raycast too.

Shoot an item (hook) in a direction as long as you hold down a key.
If you let go of the key then remove the item again.
If you connect with something and you still hold down the key, then set the hook in a “stuck” state.
While stuck and you still holding the key down, then create a vector between you and the hook in the hooks direction.
Use the vector direction to add a force from you towards the hook, for example using rigidbody.AddForce().

This is probably a good tutorial for the concepts: