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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:14:54+00:00 2026-05-24T07:14:54+00:00

I’m trying to develop a game. I have a starting point with and starting

  • 0

I’m trying to develop a game.

image demonstrating concept

I have a starting point with and starting vector (blue), next I draw on screen the path (black) which I want to follow with a certain inertia, or limited angle and step each turn that should result a red line.

Do you have any tips on how to program such algorithm?

  • 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-24T07:14:54+00:00Added an answer on May 24, 2026 at 7:14 am

    You can just create a differential scheme, i.e. model speed and coordinate of the source point at discrete moments in time. Say you fix some dt = 0.1 sec for example, starting speed is given by blue vector as v0. We start at x0.
    Say y[j] are the points of the black path.

    Let x1 = x0 + v1 * dt, where v1 = v0 + (y[k(x0)+1] - x0) * f(abs(y[k(x0)+1] - x_0)). Where
    k(x0) is the index of the nearest to x0 point among y[j],
    f(x) is a function characterizing the ‘force’ pulling your trajectory to that of the defined path. It defined for nonnegative xes only.

    This models pulling your trajectory to the next point in the defined path to that closest to current modeled position on the trajectory.

    A good example of f(x) could be one modeling the gravitational force: f(x) = K/(x * x), where K should be adjusted experimentally to be giving natural desired results.

    Then x2 = x1 + v2 * dt, where v2 = v1 + (y[k(x1) + 1] - x1) * f(abs(y[k(x1) + 1] - x_1)) and so on:

    x[n+1] = x[n] + v[n+1] * dt, where v[n+1] = v[n] + (y[k(x[n]) + 1] - x[n]) * f(abs(y[k(x[n])+1] - x[n]))…

    You’ll have to adjust dt and K here. dt should be small enough for the trajectory to be smooth. Bigger K makes trajectory more close to defined precisely, smaller K makes it more relaxed.

    Edit now actually when I thought a little bit, I understand that selection of the force function f was not good, as gravitational force allows space velocities, i.e. ability for your trajectory to fly away from the desired one infinitely if the initial speed is too big. So you should construct another function, possibly just something along the lines of f(x) = K x or f(x) = K x ^ alpha, where alpha > 0. You see, this scheme is quite general, so you should experiment.

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

Sidebar

Related Questions

I have been trying to develop an app for my ipad which i can
I am trying to develop a Java 2D game and I have a problem
I am trying to develop a car game in which opponents are coming from
I'm trying to develop a simple text-based hangman game, and the main game loop
i usually develop for iPhone. But now trying to make a pong game in
Im trying to develop my first ASP.NET MVC web app and have run into
I'm trying to develop a card game with Flex, and I was wondering if
I'm trying to develop an oldschool NES-style video game, with sprite flickering and graphical
trying to develop web form using jquery. all i need is to have several
I'm trying to develop a basic GPA Calculator. I have an AllCourses class that

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.