I am trying to build a four bar mechanism. I used hinge joint and configurable joints to connect each bar and added a script to rotate bars. now I need to make users change the length of each bar. when they change the length of one bar with respect to that bar, other bars also should change their length. I want to save these changes and rotate the bar.
below link is four bar mechanism.
I’m not quite sure I understand your question, is this what you are looking for?
If your record you adjustable bar’s localScale, before and after you adjust it:
you can then scale another object by the same amount if you multiply its own localScale by localScaleAfter / localScaleBefore (component-wise)
e.g. (uncompiled/untested)
Vector3 scaleBy = new Vector3(
localScaleAfter.x/localScaleBefore.x,
localScaleAfter.y/localScaleBefore.y,
localScaleAfter.z/localScaleBefore.z);
followbar.transform.localScale= followbar.transform.localScale.Scale(scaleBy);
Watchout for divide by zero!
I am trying to create a four-bar mechanism. so I used four cubes and connected in form of four-bar linkage shape. I attached rigid body component to them and used configurable joints and hinge joints for the rotation of all bars.
when I play, those bars rotate automatically but I want them to rotate according to touch motion.
So can anyone please help me with it.