Simulating muscle contraction or using hydraulic piston to move hinge joint

I am trying to simulate moving two rods hinge jointed like an excavator arm or an elbow. Using the hinge joint motor isn’t giving me the fine control I need, So I am trying to make a hydraulic piston-like device attached to the center of each rod to move them closer and further apart. I cant think of a good way to do this without adding a million additional rigidbodies and joint components.

Is there a good clean way to do this properly through scripts? It would need to behave properly as far as the physics engine is concerned. Thanks!

Yes, there is a way to do this through scripts, which would involve a lot of trial-and-error. You could even use a script to add your hindge joints to the model/rig/arm. Btw, the hindge joints can provide fine control by either driving them via forces/torques or position. So perhaps your input data to the joint is noisy rather than it being an inherent issue with the joint itself.

Also, there is no shame in using a million additional rigidbodies. In fact there are a lot of myths out there about how using many rigidbodies will devastate game play due to bad frame rates, but in fact these days with GPU support , using many physics components is not an issue any longer, even for mobile applications.

I regularly use upwards of 70 hindge joints and rigidbodies for my VR applications running on the Quest-1 without any issues.

Hope this helps in any way.