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 614341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:06:07+00:00 2026-05-13T18:06:07+00:00

I’m trying to get my simulation to stop on a specific point. I have

  • 0

I’m trying to get my simulation to stop on a specific point. I have my starting position, an ending position, my current velocity and the time I’d like to take to get there. Since:

d = vt + (at^2)/2

I was figuring that

d = (end - start)
a = 2(d - vt) / t^2

but my end point is way off when I run it. I’ve tried using two simple updates, first:

v += a * dt
d += v * dt

and second:

d += v * dt + a * dt * dt / 2;
v += a * dt;

if that matters. Position in this case is 1d, so no need for crazy vector stuff. Any help would be greatly appreciated 🙂 Thanks!

(Edit: formatting)
(Edit2: corrected update #2)
(Edit3: updates now show dt instead of t)

  • 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-13T18:06:07+00:00Added an answer on May 13, 2026 at 6:06 pm

    We start at x_start (and t=0), with speed v_start, and we want to end at x_end, with velocity zero.

    Since we have a constant acceleration, the average speed will be v_start/2, which means we’ll reach x_end at t_end = (x_end - x_start) / (v_start / 2).

    Okay, so then we can use x(t) = x_start + v_start * t + at^2/2. As a sanity check, plug in t=0 and make sure you get x = x_start.

    Then plug in t_end and you can solve for a. I get -v^2/(2D) where D is x_end - x_start. The negative sign just means you’re slowing down instead of speeding up.

    If you plug this into the original function you get:

    x(t) = x_start + v_start * t - (v^2/4D) * t^2
    

    If you have a counter that tells you the value of t (which will vary between 0 and t_end), you can simply move the object to the correct position at each moment.

    Or (and this might make more sense, depending on the language, environment, etc.), you can calculate the instantaneous velocity each timestep by, and then the instantaneous position, following CoderTao’s answer.

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

Sidebar

Related Questions

No related questions found

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.