pulling an object off the ground and containing it

i want to be able to pull objects towards the playing and the following code is working fine except when there is an overhang between the player and object

    private void FixedUpdate()
    {
        //Frame-rate independent for physics calculations and anything that runs at fixed rate.

        if (_PullAnimationIsPulling && _HitTargetGO)
            PullHitTargetGOTowardsPlayersRWrist();
    }
    public void PullHitTargetGOTowardsPlayersRWrist()
    {
        if (_DistancePlayerToHitTarget <= _NewDistancePlayerToHitTarget)
        {
            ClearNewDistancePlayerToHitTarget(); // got there so stop moving
            return;
        }

        Rigidbody rb = _HitTargetGO.transform.GetComponent<Rigidbody>();

        const float speed = 60f;
        Vector3 direction = _pc._wristR.position - _HitTargetGO.transform.position;
        Vector3 movingStep = direction.normalized * speed;
        //Debug.Log("PullRopeSMB movingStep=" + movingStep);
        rb.AddForceAtPosition(movingStep, _ActiveArrow.transform.position, ForceMode.Impulse);
    }

the problem is if i am up on a ledge, i can pull the object towards me but after the effect of the impulse fades away, the object falls back to the ground.

how would i constrain it so it stay stays say a fixed distance from the player?

by the way, _ActiveArrow is a child of the thing i’m pulling (was parented when i hit the thing) and the point at which i want the thing constrained. maybe i can somehow freeze the position of that?
thanks

ops, i meant the title to say constraining it, can’t fix

There are a bunch of ways you could do it:

  • You could activate the constraints on the RigidBody component.
  • You could disable gravity on the object and set its velocity to zero. You could then keep updating the object’s position to match a target transform if the point of constraint is moving
  • You could write a PID script and give it the desired location, for a smoother moving constraint.

Not sure if that answers your question, as its a little hard to decipher exactly what your setup is, but hopefully it provokes some thought.