• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Expressions 101 - rotation and postion

Explorer ,
Jul 27, 2017 Jul 27, 2017

Copy link to clipboard

Copied

I just don't understand this basic expression and why it's causing this result. I wanted to make a circle rotate properly along a path, like a ball rolling. I started to play around and when I pick whip my rotation to the separated position dimension of X and start adjusting the X position, it works, but why? All that is in the expression is "transform.xPosition" so I am not understanding where in that tiny expression that if the position moves the object should rotate equally. I feel like to do that would entail a much more extensive expression. Any help explaining this is greatly appreciated!

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Jul 28, 2017 Jul 28, 2017

OK... to answer my own question : )

The key thing to note is that a pick-whipped expression basically  just copies the values from one property to another - and those values are unitless. They are interpreted in terms of the units of the property to which they are applied. So in your case X pixels of movement is interpreted as X degrees of rotation.

You need to work out what proportion of a circle's circumference is the distance moved, which is:

distance / (Pi x diameter) . Having got the proportio

...

Votes

Translate

Translate
Advisor ,
Jul 27, 2017 Jul 27, 2017

Copy link to clipboard

Copied

You got lucky ; )
I bet your ball was just over 100px in diameter?  Ideally about 115?

Your expression says: make my rotation equal my x position movement.

ball moves 360 pixels to the right = ball rotates 360 degrees clockwise.

For the ball to rotate without slipping or skidding it's circumference would need to equal the distance it moved.

Diameter = circumerefence / Pi    = 360 / 3.14    = 114.6 pixels.

Your homework, should you choose to accept it... 

make an expression that rolls without slipping or skidding for a ball of any size : )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

OK... to answer my own question : )

The key thing to note is that a pick-whipped expression basically  just copies the values from one property to another - and those values are unitless. They are interpreted in terms of the units of the property to which they are applied. So in your case X pixels of movement is interpreted as X degrees of rotation.

You need to work out what proportion of a circle's circumference is the distance moved, which is:

distance / (Pi x diameter) . Having got the proportion, you can x 360 to calculate the degrees.

In expression speak:

dia = 300;

transform.position[0] / (Math.PI * dia) * 360

Notes:

1. Change the number 300 to whatever your circle diameter is.

2. No need to separate the dimensions. The '[0]' at the end of transform.position says 'use the first ('X') value'.

Here is the site to learn all about expressions from the master:

http://www.motionscript.com/index.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

LATEST

Ha! You are correct, I got lucky... about 120px on the circle, now this is making sense!

And I will do my homework!

Thanks Mike!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines