custom attrs on the crank: crankSpeed, conRodLength, crankRadius
expression on the crank:
crank.rotateX = time * crank.crankSpeed
expression on the piston:
piston1.translateY = sqrt( pow( crank1.conRodLength, 2 ) -
pow( crank1.crankRadius * sind(crank1.rotateX), 2 ) ) -
( crank1.crankRadius * cosd(crank1.rotateX) );
expressions on the conRod:
conRod1.translateY = crank1.crankRadius * -cosd(crank1.rotateX);
conRod1.translateZ = crank1.crankRadius * -sind(crank1.rotateX);
conRod1.rotateX = -atan2d( conRod1.translateZ,
sqrt( pow( crank1.conRodLength, 2 ) - pow( conRod1.translateZ, 2 ) ) );
This works like a charm
So I duped the assembly over in X twice so I have a row of pistons. I changed the phase of the duped cranks to 120 and 240 respectively by adding those values into the rX expressions.
Then I added in 120 and 240 respectively in the rod and piston expressions where there were instances of crank#.rX. so the second conRod looks like this:
conRod2.translateY = crank2.crankRadius * cosd(crank2.rotateX + 120);
conRod2.translateZ = crank2.crankRadius * sind(crank2.rotateX + 120);
conRod2.rotateX = -atan2d( conRod2.translateZ,
sqrt( pow( crank2.conRodLength, 2 ) - pow( conRod2.translateZ, 2 ) ) );
but I wind up with a strange out of phase syncronization.
The first crank is in the center. I just duped a set to each side for sake of symmetry while I worked. so the cranks on the ends are slightly out of phase in their connections, but I can't see where I've erred...