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

Single vector deceleration

Explorer ,
Dec 02, 2008 Dec 02, 2008
Hello,

I think this is one of those dead simple problems, yet I can’t seem to figure out what is going on...

I’m trying to get an object/ball to start at some speed, smoothly decelerate, and stop exactly as some specified distance.

The formula I’m using is from 1d kinematics:

V(f)^2 = V(i)^2 + 2ad

V(f) is 0, since I want it to stop moving, acceleration I have set to -1, and distance I have set to 100.

V(i) = squareRoot(-2 * a * d);

Yet when I run it, my object starts at 0px, and stops at 92.95px and I can't figure out why it never reaches whatever my distance is set as.
TOPICS
ActionScript
343
Translate
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

Guru , Dec 02, 2008 Dec 02, 2008
although i would run a decel formula a bit differently, I'm just wondering why you may not be able to use a tween with easing here? as in:

import mx.transitions.Tween;
import mx.transitions.easing.*;
new Tween(ballClip, '_x', Strong.easeOut, 0, 100, 1, true); //one second
Translate
Guru ,
Dec 02, 2008 Dec 02, 2008
although i would run a decel formula a bit differently, I'm just wondering why you may not be able to use a tween with easing here? as in:

import mx.transitions.Tween;
import mx.transitions.easing.*;
new Tween(ballClip, '_x', Strong.easeOut, 0, 100, 1, true); //one second
Translate
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 ,
Dec 02, 2008 Dec 02, 2008
Hm, I never thought of that and it does work for a single ‘push’ motion. I want to keep being able to ‘push’ this object along, every time another 100 (or some determined amount) pixels more. How would you do this with the tween class? Create a new tween every time?
Translate
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
LEGEND ,
Dec 02, 2008 Dec 02, 2008
>>How would you do this with the tween class? Create a new tween every time?

Yup... but I'd suggest ditching the crappy built-in Tween class and using
Tweener, or any other of the much better 3rd party classes.


--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Translate
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 ,
Dec 02, 2008 Dec 02, 2008
LATEST
Hm, okay. It looks like it would work fine then. Thank you both for your fast responses.
Translate
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