I want to make two cylinders rotate as if they were rigid bodies to give more realism to the model, to create the two cylinders and trying to connect the first with the pivot only get it to stay fixed on the part of the sphere the other end moves , I searched the internet and did not look for the answer, I already used the commands: transform.rotation, transform.Rotate, etc.
What I’m looking for is to manually make the movement or draw a line from the starting point to the end with the equation of distance between two points to be able to connect both rods in their corresponding positions. Thank you
I leave a video to understand better what is happening with my animation:
P.S. my code in the script of the first cylinder is the following:
x1 = l1 * Mathf.Sin (T1); // coordinate on x of the rod 1
y1 = -l1 * Mathf.Cos (T1); // coordinate on y of the rod 1
// distance between two points (from origin to mass 1)
// posx1 = (Mathf.Sqrt (x1x1));
// posy1 = (Mathf.Sqrt (y1y1));
posx1 = (l1 * Mathf.Sin (T1)); // distance in x of the rod to the origin
posy1 = (l1 / 2) - (l1 * Mathf.Cos (T1)); // distance in y from the rod to the origin
transform.localPosition = new Vector3 (posx1, posy1,0.0f);