This content has been marked as final. Show 4 replies
I can't explain the reason although I found a way to visualise it and a way to avoid it.
kglad usually makes an appearance soon and he's the resident math expert. Perhaps he'll be able to shed light on it.
Check out the 2 options below.
Many thanks for your suggestion.
I was working in the same direction. As my object is not following the full path of a circle (just an arc section of a circle and then coming back - as a pendulum), I created two reference points (orig_x1 and orig_x2) at both ends of its path. This keeps the object on its place but on each path end you can percieve a small hesitation (that's when the correction happens).
So I think I am gonna use tweening with motion guides to get my object moving.
But for a correct motion I need two motion guides for one single object?
Just imagine: my object in a line, and both ends are following the path of a arc. But the arcs do not have the same circle diameter. Suggestion?
Anyway, I like to thank you for your reaction on the drifting subject.
your code is defines a path along a spiral.
if you don't want your movieclip to move along a spiral don't increment the _x, _y properties, just assign them like in gwd's alternative approach.
for a pendulum motion using actionscript, you''ll need 4 tweens. two start the motion and two to execute onMotionFinished.
in your onMotionFinished define a toggle to alternate the start and end points of your tween.
if you're tweening in the authoring environment, you should be able to create motion from left to right (or right to left) along your arc and then copy and paste those reversed frames to complete the motion.
My guess would be twips. Yup, twips!
That is twentieth of a pixel and also the "resolution" that flash uses for moving things on stage. So anything finner that .05 will be dropped from the _x and _y you are setting. And with sin and cos that is a lot!
So instead of directly setting your positions with the calculations assign them to a currentX/currentY (or whatever) do the calculations there and then assign them to the _x and _y.
Also GWD post is a great solution with regard to controlling it. You can even rename orig_x to centerX and then manipulate that over time to cause drift that you DO want.
Finally if you are doing pendulum motion, I would suggest looking at rotation instead of circular motion. Here is a page:
Near the bottom there is this equation:
There may need to be some multipliers and all to convert from radians to degrees and such, but that should give you the basic structure. normally the artwork for such a thing would have the centerpoint at the top of the "string", but if you want both ends to "swing" then put the center/pivot point down the string a bit.