Deceleration calculation for moving screen objects

Click For Summary

Discussion Overview

The discussion revolves around calculating natural deceleration for a VB.NET touchscreen project, specifically how to implement a coasting effect for scrolling objects. Participants explore different methods for determining stopping distance and time, considering factors like initial swipe speed, mass, and friction.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant suggests three options for calculating deceleration: a fixed stopping distance, a fixed time to stop, or using mass and friction to calculate both time and distance.
  • Another participant proposes an iterative method where the new speed is a fraction of the old speed, which mimics realistic friction but complicates control over specific deceleration values.
  • A different viewpoint emphasizes using linear acceleration or proportional speed reduction to simulate motion, depending on whether the scenario mimics a thrown object or a flat surface.
  • One participant clarifies that their project aims to replicate touchscreen functionality similar to modern devices, indicating a desire to learn and implement effective solutions.
  • Another suggestion includes separating velocity components in X and Y directions to simplify calculations and achieve accurate rebounds from walls.
  • Participants discuss the applicability of a formula from a Microsoft page, noting its limitations in real-world scenarios with friction and suggesting alternative approaches for more realistic motion simulation.
  • A participant reports success in implementing a suggested equation for calculating new speed based on friction and mass.

Areas of Agreement / Disagreement

Participants express various methods for achieving deceleration, with no consensus on a single approach. Some methods are favored for their realism, while others are critiqued for their complexity or lack of control over outcomes.

Contextual Notes

Participants note that the effectiveness of certain equations may depend on specific conditions, such as the presence of friction, and that the original formula from Microsoft may not yield usable results in practical applications.

Who May Find This Useful

This discussion may be useful for developers working on touchscreen applications, particularly those interested in implementing realistic motion and deceleration effects in their projects.

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

  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 46 ·
2
Replies
46
Views
12K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
10K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K