tags:

views:

43

answers:

1

Hi all,

I believe this is a fairly simple question but I have no idea where to start.

I'm trying to implement a feature where an entity (such as an image) can be flicked across the screen such that it decelerates over time based on an initial speed (non-zero) and coefficient of friction.

In other words, given an initial velocity and constant friction, how can I programmtically determine where an object will be at time t??

Feel free reply using pseudo-code or any programming language you're comfortable with.

Thanks guys

+3  A: 

The equation is

s = u*t + 0.5*a*t*t

where,

s is displacement (i.e. position)
u is the initial speed (can be zero too actually)
a is the acceleration (if you want deceleration use a negative value instead)
t is the time elapsed

To account for friction your a will be (on a horizontal surface)

a = -μg

where,

μ is the coefficient of friction
g is gravitational acceleration
Ashish
That doesn't seem to take friction into consideration. EDIT: Oops, sorry I didn't see your next edit.
Hovito