Chain movement during scripted rotation.

Hi,

I’m learning the chain movement, like the lamp in the bootcamp demo. but in this case it’s a chain attached to a stick (cf the sketch), I use the same configuration as the bootcamp demo, I moved the anchor point to be at the good place. I’m using this script to rotate the stick:

            if (Input.GetMouseButton(0))
            {


                //Set the AmtToRotate
                xDeg += Input.GetAxis("Mouse X") * xSpeed * SpeedCoef;
                yDeg -= Input.GetAxis("Mouse Y") * ySpeed * SpeedCoef;

                // Make sure that the yDeg is still in the Y limits
                yDeg = ClampAngle(yDeg, yMinLimit, yMaxLimit);
                
                //Use the AmtToRotate to rotate the camera
                desiredRotation = Quaternion.Euler(yDeg, xDeg, 0);
                currentRotation = transform.rotation;
                //Add a damping
                rotation = Quaternion.Slerp(currentRotation, desiredRotation, Time.deltaTime * RotDamp);
                transform.rotation = rotation;
                
            }

My stick rotate fine but I can’t give a centripete force to my chain. I’ve got a good physic when I’m moving the stick on the Y axis with the mouse (so i’m leaning the stick).

Why doesn’t it take the centripete force when i’m rotating it ? It stays stuck to the stick…

450775--15711--$Untitled.jpg

up

up

How to rotate an object with a chain attached to it and make the chain moves with the centripete force during the rotation ?

If you rotate the object using transform.Rotate, then the physics engine can’t respond to the movement and give the right centripetal acceleration. One way to handle this is to implement the chain using a chain of joints. Generally, the chain links should have a lower mass than the object on the end of the chain to enhance the effect.

Hi,

Thank’s a lot for that but my chain is already configured with hinge joins and my chain is lighter than my objet at the end of the chain.

Here i’ve got a scripting problem, I was sure that my problem came from the rotation script, so what kind of script should I use to do a physical rotation which give to my object an angular speed and so a centripetal force.

ok i found my rotation problem, My stick is composed of two part with an empty gameobject as parent, the script was connected to the parent and the rigibody on a child… I connected the script on the child with the rigidbody and now it rotates.

But I’ve got a stretching problem. When I’m rotating, the rotation speeds up then the chain is stretched and the “0” shaped links are disconnected. And the chain starts to have inter penetration in the stick. With a slow movement no problem.

How can i correct that ?

up

up