Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3661712
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:20:08+00:00 2026-05-19T01:20:08+00:00

I have an OpenGL ES View in Android thats controlled by a matrix for

  • 0

I have an OpenGL ES View in Android thats controlled by a matrix for translation. Im trying to figure out a way to get a hint of momentum scrolling as seen in the google maps app or the iPhone. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:20:09+00:00Added an answer on May 19, 2026 at 1:20 am

    If your problem is in 2d, it is quite simple

    1. You need to get the elapsed time in each frame
    2. Your onTouch function will find the acceleration of your finger. I forgot the formula on how to get the acceleration from a distance. It should be the second derivative of position with a time variable. But you should always convert your deltaX, deltaY in acceleration. To make it easy you don’t really need to put something accurate there. Edit: I don’t know why I didn’t see it but the function was all there…

      acceleration.x = 2(newposition.x – position.x – speed.x * elapsedTime) / (elapsedTime * elapsedTime);

    3. Once you have your acceleration you can set your new position with that code. This is simple physic dynamics in 2d. With your acceleration you can find your speed and with your speed you can find your next position.

      speed.x = (float) (mass * acceleration.x * elapsed + speed.x);
      speed.y = (float) (mass * acceleration.y * elapsed + speed.y);
      
      
      position.x += mass * acceleration.x / 2 * elapsed * elapsed + speed.x * elapsed;
      position.y += mass * acceleration.y / 2 * elapsed * elapsed + speed.y * elapsed;
      
      
      speed.x *= friction;
      speed.y *= friction;
      

    Mass and friction will let you define how fast it goes and how fast it will slow down by itself. You probably will have to tweak the code because this dynamic isn’t exactly nice if you have to have to scroll backward to slow down.

    At the end of each frame, you will have to reset your acceleration to (0,0). And on each new frame after a touch even, the acceleration should be set to something. It should work very well 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out the best way to play a tutorial video in
I have created an iPhone application based on an OpenGL view. Now I would
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I am trying to create a simple 3-D app for android that will have
I'm using OpenGL to render a game view in my android application. The game
I have an OpenGL view that I would like to manually modify and redraw
I would like to have an OpenGL view with an utility application. What I
I have written an application using opengl es view. Now I want to add
I am trying to put an OpenGL View into my application but I want
I have an OpenGL view that renders a 3D model. It is a basic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.