Check out example codes for "unity dynamically set hinge joint spring target position". It will help you in understanding the concepts better.

Code Example 1

using UnityEngine;
using System.Collections;


public class HingeExample : MonoBehaviour
{
    void Start()
    {
        HingeJoint hinge = GetComponent<HingeJoint>();

        // Make the spring reach shoot for a 70 degree angle.
        // This could be used to fire off a catapult.

        JointSpring hingeSpring = hinge.spring;
        hingeSpring.spring = 10;
        hingeSpring.damper = 3;
        hingeSpring.targetPosition = 70;
        hinge.spring = hingeSpring;
        hinge.useSpring = true;
    }
}

Learn ReactJs, React Native from akashmittal.com