Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

linking precomped wheel rotation to position in another comp

Beitragender ,
Feb 09, 2011 Feb 09, 2011

Hey guys,

I suck at expressions, but I think one would really help me here.  I have a car driving, part of a complicated precomp, and i want the wheel rotaion in the precomp to rotate according to the position of the car in the master composition.  I've seen a few link-rotation-to-position scripts but can't find one that i can figure out how to alter in order to make it work. 

Hope someone can help, and apologize in advance if this is well worn territory.  I tried a search but could have easily not used the right key words.


Thanks in advance,

Mike

THEMEN
Ausdrücke
4.5K
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines

correct answers 1 richtige Antwort

Community Expert , Feb 09, 2011 Feb 09, 2011

The comp and layer names need to be in quotes.

Dan

Übersetzen
Community Expert ,
Feb 09, 2011 Feb 09, 2011

Assuming that you're talking about horizontal movement and the width of your wheel layer is the same as the wheel's diameter, the relationship will be like this:

x = comp("Main Comp").layer("Car").transform.position[0];
360*x/(Math.PI*width)


If you want to tie the rotation to how far the car has moved, you might do it like this:

P = comp("Main Comp").layer("Car").transform.position;

x = P[0] - P.valueAtTime(0)[0];
360*x/(Math.PI*width)

Dan

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Beitragender ,
Feb 09, 2011 Feb 09, 2011

Thanks Dan,

I can't tell you how helpful your expressions are, though I'm sure you hear that all the time.

So, this is probably just down to my lack of understanding, but it's giving me this error...

After Effects warning: Class ‘global’ has no property or method named ‘SC_05_DOOR’

Expression disabled.

here's how i used the script:

P = comp(SC_05_DOOR).layer(THEROD2).transform.position;

x = P[0] - P.valueAtTime(0)[0];

360*x/(Math.PI*width)

The main comp is "SC_05_DOOR" and the precomp is "THEROD2" and within that there's the actual car with the wheels called "CAR SC SIDE"

Thanks for everything,

Mike

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Feb 09, 2011 Feb 09, 2011

The comp and layer names need to be in quotes.

Dan

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Beitragender ,
Feb 09, 2011 Feb 09, 2011
AKTUELL

Aw dangit, i thought that was you telling me what to change.  I thought i was being smart by taking them out.  I won't assume that about myself again...

Thanks so much Dan!!!

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines