Deceleration calculation for moving screen objects

AI Thread Summary
The discussion centers on implementing natural deceleration for a VB.NET touchscreen project, specifically for scrolling objects that coast to a stop. The user considers three options for calculating deceleration: fixed stopping distance, fixed time to stop, or using mass and friction to determine both time and distance. The latter option is favored for its flexibility, allowing adjustments based on swipe length and speed. Participants suggest using an iterative approach to reduce speed by a factor, which mimics realistic friction and provides satisfactory results for the desired functionality. The user reports success after applying the recommended formula, indicating it meets their needs effectively.
BeanAnimal
Messages
4
Reaction score
0
Long story short...

I am having a hard time creating natural deceleration for a VB.NET touchscreen project. I would like to be able to scroll an object and allow it to coast to a stop.

The starting velocity will be set by the swipe speed of the finger. Let's call it pixels/millisecond. That leaves me with a DISTANCE and TIME to 0 velocity as unknowns.

My Choices (at least as I see it).

a) Choose a fixed stopping distance (maybe based on the length of the initial swipe) and then calculate the time needed to reach 0 velocity.

-or-

b) Choose a fixed time to reach a 0 velocity and calculate the distance the object will decelerate over. ( I don't like this option at all)..

-or-

c) Give the object a mass and friction, then calculate both the time and distance to reach 0 velocity. (appealing because both mass and friction could be adjustable, even set based on the length and speed of the initial finger swipe. I.E. short swipe = higher friction, longer swipe = lower friction).

I am having trouble applying (and/or understanding) the proper kinametics or inertial formula.

Here is a "Microsoft Touch" information page would be the ideal model for what I am trying to recreate. This MS Touch functionality is not available on the platform I am developing for (not to mention that I would really like to learn how to figure this out on my own the next time).

Thanks in advance,

Bill
 
Last edited:
Physics news on Phys.org
what is often used is this (iteratively):
new_speed = old_speed * factor
with
0 < factor < 1
until
old_speed < small_number (object stopped)

it is efficient, and gives similar results to realistic friction (option c). but as with (c) its is harder to control for specific value for deceleration time / distance.

option c) could look like this
new_speed = old_speed - (old_speed ^ 2 * friction_factor * delta_time)/mass
 
Is this supposed to mimic the motion of a thrown ball or are you on a 2d flat surface - like an air-hockey table?
Normally you use either a linear acceleration where you just pick an amount of speed to subtract in each time interval and make the object stop when the speed reaches zero - this is good for simple thrown objects.
Or you make the acceleration proportional to the speed, so you reduce the speed to say 0.9 of the previous speed in each time interval - and stop the object when the speed reaches some small value. This looks more realistic for real world objects where there is a lot of drag (friction).
 
Wow... fast responses in this forum!

This is supposed to mimic the motion on a 2D surface (like the air hockey table). The idea is to derive the same type of sliding functionality found in modern touchscreen applications like the iPhone, WindowsMobile 6.1, etc. To be more precise, I was unable to find jukebox software that fits my needs, so I am writing my own (VB.NET) and would like to implement the functionality for browsing through cover art, tracks etc. I also don't like being stumped by a problem, so I have set out to learn what I need to know.

I will see if I can setup a simualtion using both methods above.

As for the being stumped...What am I missing with the equation on the MS page? It just does not appear to give me usable results.
 
Another tip - don't try and deal with angles. Use the velocity in X and Y separately and use the fractional version ie speed in each time interval is 0.9 (or whatever) the previous one separately in X and Y.
This will even give the correct rebounds from the walls - just flip the sign of the appropriate velocity
 
The equation they give is X = Vo t - d t^2
Is normally written as s = ut + 1/2 a t^2
Just says that the distance an object moves 's' is the initial speed 'u' * time it was moving for, minus the deceleration * time *time.
This is true for an object moving at constant acceleration (or decelration) such as a weight falling in vacuum. it isn't true for most everyday cases with friction where the slowing depends on the speed.
For those cases just making the speed in the next second to be eg. 90% of the speed in the previous second looks more real
 
Thanks again. I have implemented the advice given:
new_speed = old_speed - (old_speed ^ 2 * friction_factor * delta_time)/mass

It appears to be working very well for my purposes.
 

Similar threads

Back
Top