Two interconnected points of rotation
Need a bit of help on this animation of "two interconnected points of rotation".
Here is a photo for visual aid:
It's basically two mechanical "levers" that are connected together by a rod. The right one is the input (green arm), which controls the "fuel arm" to the left.
I managed to get the rod to rotate properly with the rotation of the input (and the rod automatically faces itself toward the anchor point of the fuel arm), but I can't figure out a way to calculate the proper angle for the fuel arm rotation (relative to input rotation angle).
For example: If green arm is rotated by 30 degrees, the resultant angle of fuel arm rotation is roughly 42.5 degrees. I'd like to make an expression for this so it's done automatically without me constantly having to manually rotate the fuel arm after rotating the green input arm.
Note: The mechanism is physically limited in the range of -40 degrees to +60 degrees, so the green input arm will never be outside of that range.
For those wondering, it's the fuel control mechanism of a PT6 turbine engine.
The top part of the image is the "zero" point. All rotation are done from this initial point. So ultimately it's the rotation angle of line "E" that I'm after, in relation to line "F" rotation.
Thanks for any suggestions!
It can be done with an iteration algorithm:
In my implementation the rod is attached to Arms 1 and 2 at Nulls 1 and 2;
Arm 2 is Input.
Arm 1 is Fuel.
This expression for Arm 1 Rotation approximates the Rotation Angle of Arm 1 till the distance between attachment points [almost] equals the length of the Rod:
Surprisingly neat expression.
Of cause, it can also been done with an explicit trigonometric formula for the Fuel Arm angle, but it's quite hideous.
Although I haven't been able to modify your expression to work correctly in my composition (yet), I'm really impressed with how quickly you came up with that! Thank you!
I modified it to try to make it work with my layer names and dimensions, but I can't figure it out.
Here's what I have so far:
Arm 1 = "FCU arm"
Arm 2 = "Cam input arm"
Rod attaches to FCU arm (arm1) at Null 1 ("Interconnect Point A - pivot")
Road attaches to Cam input arm (arm2) at Null 2 ("Interconnect Point B - pivot")
Null 1 parent is FCU arm
Null 2 parent is Cam input arm
Rod position expression:
B = thisComp.layer("Interconnect Point B - pivot");
Null 3 ("Rod Point C") is parented to the rod (where it attaches to FCU arm (arm1).
Used to calculate rod length.
Link to AE file below, if you want to have a closer look
Appreciate any further help,
The implementation is generally fine as is.
If you put the Rod layer ("FCU Interconnect Rod") beneath the FCU arm layer, it will work like intended, as I presume:
Switching layers' order is not a proper solution though, the problem is that you have a cross reference:
Rod -(expression)-> A
A -(child)-> FCU arm
FCU arm -(expression)-> C
C -(child) -> Rod
Rod -(expression)-> A -(child)-> FCU arm -(expression)-> C -(child) -> Rod
In this case Gd only knows in what order AE will render and what output you'll get.
If Rod is above FCU arm you get this:
If Rod is below FCU arm you (may) get:
The Rod image is in the right place but null and source rectangle are not.
This can be cured by cache cleaning but may also lead to various bugs in the future.
Bottom line, you would probably wanna find another way to define the Rod length (maybe just a constant), thus breaking the reference loop at C-point. Namely, getting rid of this reference:
Thank you much for the help! I got that interconnect working with your expressions and suggestions.
I decided to use the constant rod length.
I am using your same method to rotate another 3rd lever, attached to the FCU arm. Still needs some tweaking, but I'm very close!
If you rotate the green "cam input lever" you can see how it works so far.
Seems to rotate the 3rd lever only after 30 degrees on the green arm.
I see you've switched to AE CC 2019. Bear in mind that it has an updated expression engine and is much more strict on syntax and
I've only tested this code in previous versions. Though, I believe, I was careful with syntax, still some issues may rise when running this code in CC 2019.