I have written a script that uses ConfigurableJoint to connect a ball to a hing so that it moves in a fixed circular path around the hinge. The problem is that I want to decrease the distance between hinge and ball with time. In other words, I wamt to reduce the radius of circular path on which the ball is moving.
I have created a rough image to demonstrate what I'm trying to do
And below is the code that I am using to create the joint:
joint = gameObject.AddComponent<ConfigurableJoint>(); joint.anchor = transform.transform.InverseTransformPoint(closestHinge.position); joint.xMotion = ConfigurableJointMotion.Locked; joint.yMotion = ConfigurableJointMotion.Limited; joint.zMotion = ConfigurableJointMotion.Locked;