-
Parenting nulls to trigonometry-controlled objects
I want to build a digram with arrows between some boxes, where the arrows are connected to the edges of the boxes. So if I move the boxes around, the arrows with change length and angle.
I’ve read tutorials about how to connect lines to other objects dynamically, using the Beam effect, but I want arrows!
Using this post – https://forums.creativecow.net/thread/227/6984 I was able to build an arrow that is controlled by two nulls (at the start and end).
But when I try to parent one of the start or end nulls to another null or object, the parent object doesn’t move the child object.. What am I missing?
video example here.
Below are some snippets of my dodgy code:
arrowlength controlled by<code>CellTower = thisComp.layer("startpoint").transform.position;
Target = thisComp.layer("endpoint").transform.position;
sizefactor = 100/(effect("ArrowSize")("Slider"));
BeamLength = (length(CellTower, Target)*sizefactor)-150;
[BeamLength]
</code>rotation of the arrow controlled by
<code>CellTower=thisComp.layer("startpoint").transform.position;
Target=thisComp.layer("endpoint").transform.position;// Find the length of side a
SideA = sub(CellTower, Target)[1];// Find the length of side b
SideB = sub(CellTower, Target)[0];//Find the Angle between them
-1*(270-(radiansToDegrees(Math.atan2(SideA, SideB))+180));</code>