Comments and answers for "Moving an object in elliptical path - but with change in scale when on top half and bottom half"
http://answers.unity.com/questions/1655316/moving-an-object-in-elliptical-path-but-with-chang.html
The latest comments and answers for the question "Moving an object in elliptical path - but with change in scale when on top half and bottom half"Comment by Captain_Pineapple on Captain_Pineapple's comment
http://answers.unity.com/comments/1655620/view.html
Hey there,
well i guess you did not use your MSin or MCos functions? when it's not the right value at the right position it's most likely a degree-radian problem.
also you can always "turn" the point of maximum and minimum scale by adding a "tilt" value like you already have it for your current ellipse. In the end A cosine(angle) is also just a sinus(angle + 90°). You might want to read a bit into the propertys of trigonometric functions. This might help you in the future solving these problems on your own.
<br>
also perhaps look into basic mathematical foundations like the Pythagorean theorem to calculate distances in 2d or 3d environments.Thu, 08 Aug 2019 09:24:37 GMTCaptain_PineappleComment by rizzunity on rizzunity's comment
http://answers.unity.com/comments/1655589/view.html
Hi Captain_Pineapple,
Ah okay. I had thought I had to use math formulas using the equations of an ellipse.
Meanwhile, I tried your second approach using Sin/Cosine as a function of alpha - but it seems that the scale gets increasingly positive values in the +ve Y axis i.e when the sphere is in the top-half trajectory. And negative values in the bottom-half trajectory! Also, this formula produces a pattern where the sphere has maximum scale at the sides (if Cos is used) or at the top&bottom (if Sin is used).
But in my case, I want the sphere to be at its lowest scale when its at the top (scale = 1), then move say - anticlockwise, and increase the scale linearly to 5 when its at the left, then move to the bottom where it will be at the highest scale (10) - then again move to the right where it will decrease to 5. Finally back to the top where it will decrease to 1. And so this cycle continues.
So, the scale of the sphere at the left and right-side will be the same i.e. 5 but the scale at the top and bottom will be opposite i.e. at the top only 1 but at the bottom 10.Thu, 08 Aug 2019 07:29:22 GMTrizzunityComment by Captain_Pineapple on Captain_Pineapple's comment
http://answers.unity.com/comments/1655387/view.html
Hey there,
assuming i understood correctly that the maximum scale should be 5 and the minimum is 1 then the maximumScale difference would be 4.
Yes the distance would be half the corresponding axis as you posted.
How come calculating the current distance is difficult? As far as i can see the center of your ellipse is (0,0) ? So then the distance would be `transform.position.magnitude`. In case the center is some other point: `distance = (center - transform.position).magnitude`Wed, 07 Aug 2019 14:27:58 GMTCaptain_PineappleComment by rizzunity on rizzunity's answer
http://answers.unity.com/comments/1655365/view.html
Hi,
If I understood it correctly, wouldn't A i.e. minimum distance from the center be (Length of minor axis/2) and maximum distance be (Length of major axis/2) ?
Also, what do you mean by "maximumScaleDifference"?
Moreover, computing currentCenterDistance from a point on the ellipse to its center does not seem to be trivial.Wed, 07 Aug 2019 12:56:29 GMTrizzunityAnswer by Captain_Pineapple
http://answers.unity.com/answers/1655325/view.html
Hey there,
2 options:
go by the distance from the center:
A = minimum distance from the center
B = maximum distance from the center
Scale should then be something like:
Scale = minimumScale + (currentCenterDistance - A)/(B-A)*maximumScaleDifference
<br>
alternatively you could go with a sinus/cosinus approach:
Scale = minimumScale + maximumScaleDifference*sinus(alpha + tilt)
(perhaps the last line should be cosinus instead of sinus, depends on where your starting point is)
Hope this helps you, if you have questions on this let me know.Wed, 07 Aug 2019 11:14:52 GMTCaptain_Pineapple