Mathematical problem

This is a discussion on Mathematical problem within the C++ Programming forums, part of the General Programming Boards category; Hi all, (this is the same post as in the games programming forum) I have a problem (isn't that obvious?) ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    32

    Mathematical problem

    Hi all, (this is the same post as in the games programming forum)
    I have a problem (isn't that obvious?)

    I am making a game which involves surface ships (a.k.a boats) and am delving deeply into the entire basic engine right now.

    Dealing with the steering AI is a real problem.
    I guess there's much more to courses and speeds than you think!

    I have one problem though...

    supposed you have a vessel which gets an input of a destination (x and y). this vessel has:

    a constant top speed,
    acceleration/decelration rate (same value) and a
    "turn per second" which is how much the ship can change it's heading right or left per each second.

    now my problems arises when i give my vessel a destination which is too close and too far to the right or left... it begins spinning around in a circle and never reaches it's destination, this is due to the fact that according to the algorithm... while the destination has not been reached... the ship is set to accelarate to top speed and keep that speed... so the ship actualy turns as much as it can, but it turns to slowly and keeps overshooting the target... am i being clear?

    basically... I need an algorithm, or mathematical function that would yield the correct speed that the ship's supposed to reach in order to get to the destination as fast as possible... i think it will have something to do with circles... but I don't know.

    again, these are my ship's variables:

    current x
    current y
    destination x
    destination y
    acceleration/deceleration (constant)
    current speed
    target speed
    top speed (constant)
    current heading
    target heading

    THANK YOU!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    So it's a cross-post then
    Mathematical, nautical steering problem
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  3. help with mathematical problem in C
    By feelseez in forum C Programming
    Replies: 3
    Last Post: 09-10-2006, 11:44 AM
  4. Mathematical, nautical steering problem
    By Warlax in forum Game Programming
    Replies: 6
    Last Post: 06-16-2006, 06:01 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21