Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE AFTER EFFECTS: HomeForumBasicsExpressionsTutorialsPodcastsMotion GraphicsTrainingCinema 4DFAQ

Re: Some trig help needed

Cow Forums : Adobe After Effects Expressions
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Re: Some trig help needed
by Nick Hill on Jul 12, 2009 at 4:52:34 pm

I *think* I've done it (well, it's good enough, at least). Expression for the rotation:


wo = effect("WheelOffset")("Angle"); // arbitrary angle control for fine tuning
Cxy = thisComp.layer("Tandem").effect("RearWheelContactPoint")("Point"); // C in the diagram
Axy = transform.position; // hinge point: A
Bxy = effect("WheelPoint")("Point"); // Rear wheel contact point: B
Dxy = thisComp.layer("TrailerWheelGuide").transform.position; // trailer wheel guide: D

c = length(Axy, Bxy);

theta = Math.atan2(Dxy[1]-Cxy[1], Dxy[0]-Cxy[0]);

sintheta = Math.sin(theta);
costheta = Math.cos(theta);
xs = Axy[0] - Cxy[0];
ys = Axy[1] - Cxy[1];

alpha = Math.asin(((sintheta * xs) - (costheta * ys)) / c) + theta;

radiansToDegrees( alpha ) + wo;


Now to figure out why the guy's shins are coming out of his shoes whenever I move the bike around....



Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:
  • Some trig help needed by Nick Hill on Jul 12, 2009 at 12:13:37 am
    • Re: Some trig help needed by Nick Hill on Jul 12, 2009 at 4:52:34 pm




Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Please post Expressions Code in the box below:


Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]