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

  • SEARCH
  • Home
  • 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 3990184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:27:49+00:00 2026-05-20T06:27:49+00:00

I have a point that moves (in one dimension), and I need it to

  • 0

I have a point that moves (in one dimension), and I need it to move smoothly. So I think that it’s velocity has to be a continuous function and I need to control the acceleration and then calculate it’s velocity and position.

The algorithm doesn’t seem something obvious to me, but I guess this must be a common problem, I just can’t find the solution.

Notes:

  • The final destination of the object may change while it’s moving and the movement needs to be smooth anyway.
  • I guess that a naive implementation would produce bouncing, and I need to avoid that.
  • 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-20T06:27:49+00:00Added an answer on May 20, 2026 at 6:27 am

    This is a perfect candidate for using a “critically damped spring”.

    Conceptually you attach the point to the target point with a spring, or piece of elastic. The spring is damped so that you get no ‘bouncing’. You can control how fast the system reacts by changing a constant called the “SpringConstant”. This is essentially how strong the piece of elastic is.

    Basically you apply two forces to the position, then integrate this over time. The first force is that applied by the spring, Fs = SpringConstant * DistanceToTarget. The second is the damping force, Fd = -CurrentVelocity * 2 * sqrt( SpringConstant ).

    The CurrentVelocity forms part of the state of the system, and can be initialised to zero.

    In each step, you multiply the sum of these two forces by the time step. This gives you the change of the value of the CurrentVelocity. Multiply this by the time step again and it will give you the displacement.

    We add this to the actual position of the point.

    In C++ code:

    float CriticallyDampedSpring( float a_Target,
                                  float a_Current,
                                  float & a_Velocity,
                                  float a_TimeStep )
    {
        float currentToTarget = a_Target - a_Current;
        float springForce = currentToTarget * SPRING_CONSTANT;
        float dampingForce = -a_Velocity * 2 * sqrt( SPRING_CONSTANT );
        float force = springForce + dampingForce;
        a_Velocity += force * a_TimeStep;
        float displacement = a_Velocity * a_TimeStep;
        return a_Current + displacement;
    }
    

    In systems I was working with a value of around 5 was a good point to start experimenting with the value of the spring constant. Set it too high will result in too fast a reaction, and too low the point will react too slowly.

    Note, you might be best to make a class that keeps the velocity state rather than have to pass it into the function over and over.

    I hope this is helpful, good luck 🙂

    EDIT: In case it’s useful for others, it’s easy to apply this to 2 or 3 dimensions. In this case you can just apply the CriticallyDampedSpring independently once for each dimension. Depending on the motion you want you might find it better to work in polar coordinates (for 2D), or spherical coordinates (for 3D).

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

Sidebar

Related Questions

I have this simple animation that moves an image from one point to another:
Let's say I have 3 point clouds: first that has 3 points {x1,y1,z1}, {x2,y2,z2},
I have to open an NSStream to a wifi access point that has only
I have a point in a rectangle that I need to rotate an arbitrary
I have a table with one field that can point to a foreign key
I have a picture that I need to resize to a specific dimension and
I understand that floating point calculations have accuracy issues and there are plenty of
I have two domains that point to the same IP, which is an Ubuntu
If I have 2 domain names that point to same website (for example: microsoft.com
I have executed a rawQuery in android that returns multiple results that point to

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.