What would it take to make a script that creates a spring joint that could drag rigidbodies, for example in Dani's karlson dev log

Not too much details just wondering what it would take, cant really wrap my head around the idea properly.

@warc692
Depends on what you mean. If you simply meant swinging the player, dani made a tutorial on how to create one, but if you mean like pulling the player towards the grapple point, im currenlty working on that myself.

So far, from what I’ve disserved, you first need to calculate the direction of the rope, then add force, towards said rope. You can do this using this function here:

void reel()
    {
        if (IsGrappling())
        {
            float distanceToGP = Vector3.Distance(player.position, grapplePoint);
            if (distanceToGP > minReelDis)
            {
                //if you are at maxGrappleDistance or beyond, you will have minGrappleRigidity
                //as you approach minGrappleDistance you will become more rigid, up to maxGrappleRigidity
                float normalizedDistance = (distanceToGP - minGrappleDistance) / (maxGrappleDistance - minGrappleDistance);
                normalizedDistance = 1f - Mathf.Clamp(normalizedDistance, 0f, 1f);
                float grappleRigidity = minGrappleRigidity + (normalizedDistance * (maxGrappleRigidity - minGrappleRigidity));

                Vector3 normalized = (grapplePoint - player.position).normalized;
                rb.velocity = Vector3.MoveTowards(rb.velocity, normalized * reelSpeed, grappleRigidity);
            }
            else
            {
                rb.velocity = Vector3.zero;
            }
        }
    }

Though you might want to follow dani’s tutorial first as that’s what I’m using as a base.
Simply add in all the values necessary and your good to go, you might want to play with the values until you find something that feels nice.

Thanks for the answer (forgot I posted this Review lol) What I was looking for was a way to drag objects. But I did look into danis tutorial detailed, and Instead I figured instead of a grapple swinging the player around, The player attached a line renderer spring joint to an object and the objects updated position would be The players screen to world point.