Configurable joint instantiated from code not rotating correctly

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class GrabPhysics : MonoBehaviour
{
    public InputActionProperty grabInputSorce;
    public float radius = 0.1f;
    public LayerMask grabLayer;


    private ConfigurableJoint fixedJoint;
    private bool isGrabbing = false;
    bool dontGrab = false;

    // Update is called once per frame
    void FixedUpdate()
    {
        bool isGrabButtonPressed = grabInputSorce.action.ReadValue<float>() > 0.5f;

        if (isGrabButtonPressed && !isGrabbing && !dontGrab)
        {
            Collider[] nearbyColliders = Physics.OverlapSphere(transform.position, radius, grabLayer, QueryTriggerInteraction.Ignore);

            if (nearbyColliders.Length > 0)
            {
                Rigidbody nearbyRigidbody = nearbyColliders[0].attachedRigidbody;

                fixedJoint = gameObject.AddComponent<ConfigurableJoint>();
                fixedJoint.autoConfigureConnectedAnchor = false;
                fixedJoint.xMotion = ConfigurableJointMotion.Locked;
                fixedJoint.yMotion = ConfigurableJointMotion.Locked;
                fixedJoint.zMotion = ConfigurableJointMotion.Locked;

                /*fixedJoint.angularXMotion = ConfigurableJointMotion.Locked;
                fixedJoint.angularYMotion = ConfigurableJointMotion.Locked;
                fixedJoint.angularZMotion = ConfigurableJointMotion.Locked;*/
                JointDrive drive = new JointDrive();
              
                drive.positionSpring = 6000;
                drive.positionDamper = 100;
                fixedJoint.angularXDrive = drive;
                fixedJoint.angularYZDrive = drive;
              
                //fixedJoint.rotationDriveMode = RotationDriveMode.Slerp;



                if (nearbyRigidbody)
                {
                    fixedJoint.connectedBody = nearbyRigidbody;
                    fixedJoint.connectedAnchor = nearbyRigidbody.transform.InverseTransformPoint(transform.position);
                  
                }
                else
                {
                    fixedJoint.connectedAnchor = transform.position;
                }

                isGrabbing = true;

            }
            else
            {
                dontGrab = true;
            }
        }
        else if (!isGrabButtonPressed && isGrabbing)
        {
            isGrabbing = false;
          

            if (fixedJoint)
            {
                Destroy(fixedJoint);
            }
        }
        else if (!isGrabButtonPressed) {
            dontGrab = false;
        }
    }
}

When i run this code (for vr) the object i pick up stays where i hold it but falls down and hangs downward even though i rotate my hand. If i set angularMotion to locked then it is very floppy even though the mass is just 1. It does not work with slerp rotation mode either.

If you want it to stay just where it is, and rotate with the hand in a fixed manner, you need to set motions and angular motions both to locked. But what it is that you’re trying to achieve?

i want the floppy joint stiffend up so i can hold items is kind of like the grabing meachanics in bonelab or bone works i am trying to recreate. btw my friend posted that for me

If you set also the angular motions to locked, it will stay locked in the same angle and position. If you want it to snap to the hand, set the linear motions to free and set targetPosition=Vector3.zero. You already have the linear drives which will drive the object to the hand.

Btw the best way to test this stuff is to just make a new project with two cubes (one kinematic, one non-kinematic), attach them with a ConfigurableJoint, then press play and play around with the parameters.