 A Flash Developer Resource Site

# Thread: Need some help with acceleration and velocity

1. ## Need some help with acceleration and velocity

Hi guys,

I need some help calculating the velocity with acceleration. To start off, I'll give a short description of what I'm trying to build. It's in german sorry, but anyone who has had physics in school will probably remember talking about this. Then the electrons move into the electric field of the first parallel plate capacitor they get diverted (that the correct word? ...sorry about my english). I think you know what I mean :P. They get attracted to the plate with the positive charge. Before they enter they only have the constant velocity in the direction of x...when they enter the field, they get get an additional velocity in the direction of y. I'm not going to go into how to calculate the velocity x (assume that it's constant)...but the velocity in the direction of y is calculated:

v = a * t ....whereas a = (Q * U) / (m * d) ...the latter is not so important...just an info.

I am trying to simulate the movement of this electron in flash...it's working so far but I have little experience with coding in AS2. Any AS actually. But I've got it working so that the particle gets diverted with the constant speed v in the direction of y....so there's no acceleration. How would I go about doing this? I can calculate the acceleration...but how do I get t? v = s / t ===> t = s/v...but how can I tell flash where to to start measuring t?

Hope my explanation was okay :P

Cheers!  Reply With Quote

2. t is your variable. assuming acceleration is constant, then position can be solved for at t:
x1 = x0 + v * t + 0.5 * a * t * t
if acceleration isn't constant, then position is a function of more than time and you'll need to address the problem differently- i can help with that, but i want to rule out constant acceleration first.  Reply With Quote

3. yes the acceleration is constant. (Q * U) / (m * d) are all constant in this case...the user can edit U and d but only before running the simulation. Well since t is my variable, the speed in the direction of y must also vary seeing as it is calculated v = a * t ...but how would I go about getting t and telling flash where to start calculating it. would it be t(x) = v0 / (x0 + v * t + 0.5 * a * t^2)? and x0 just being defined at the point of entry into the field?  Reply With Quote

4. seems like you're on the right path- x0 is the position when t = 0. velocity should only be solved for initially, after that you're only solving for position with respect to time.  Reply With Quote

5. okay that seems solved. My inexperience with code still wont allow me to do this though. How do I get the values for x0 via code?  Reply With Quote

6. x0 is the x and y position of your electron when you start the simulation (when t = 0)  Reply With Quote

7. okay thanks for the help!  Reply With Quote

8. Let me blow my horn a little? Here is how to do it with tweener. You will have to type your equation in, and that's it.  Reply With Quote

9. thanks...seeing as I don't understand most of it Ill have to look into it...I do program in C++ so I was thinking of just programming a function that loops and always calculates the position and returns the value.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap 