Hmmm… that’s a good start, but I need something that works in relation to a crosshair. I need the grapple to target grapplable objects closest to where my character is aiming in screen space.
I suppose that I could make each grapplable object within a radius of my character shoot a ray at her. If they hit her, then I could store the angle between her aim vector and the vector from each grapplable object in an array and retrieve the object that generates the smallest angle. That would mean that she would always grapple objects closest to where she is aiming, right?
I think the problem with this system is that the rays will always shoot from the center of each grapplable object. I’ll have to place several grapple points on the surface of each grapplable object so that my character can grapple the edges of objects. I wish there was a way to generate grapple points from vertices.