User Tag List

Results 1 to 2 of 2

Thread: Maths Problem

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    Maths Problem

    I've been stuck on this one problem for months now, and I'd really apppreciate it if anyone is able to help me find a solution.
    I've already asked on other programming and maths forums, but so far no-one's managed it, and I'm getting *really* frustrated.

    Anyway...
    I have a vehicle which I move using a fairly conventional 360º custom movement.

    The game is "turn-based", meaning the action pauses every second or so, to allow the player to plot a course for the vehicle.

    The code looks something like this:

    + Player presses "Spacebar"
    + TimeLeft = 0
    -> set TimeLeft to 50

    + TimeLeft > 0
    -> set Speed to Speed + Acceleration
    -> set Angle to Angle + Turning
    -> set X to X + (Cos(Angle) * Speed)
    -> set Y to Y - (Sin(Angle) * Speed)
    -> subtract 1 from TimeLeft


    Here's where it gets tricky...

    I want the player to be able to choose a destination for the vehicle using the mouse (ie. the point where the vehicle will finish at the end of the next action phase).
    Anyone who's played "Critical Mass" should know what I mean.

    This means I somehow need a way to calculate the constant rates of;

    * Acceleration
    * Turning

    based on...

    * Start Speed
    * Start Angle
    * Start X
    * Start Y
    * Mouse (target) X
    * Mouse (target) Y

    There will be restraints on the maximum rates of acceleration and turning, but I think it should be possible to add them later?

    I don't need the vehicle to stop when it reaches the destination, and I don't care what direction it ends up facing.
    The vehicle must finish at the destination, at the end of the action phase - it is not enough to just pass through the destination point at some point during the action phase.

    This is the best I've achieved so far:
    http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Steering.exe
    I need something much faster, and with "pixel-perfect" precision.

    So far, people have suggested using a "Spiral Formula" and "Bézier Curves" as possible solutions.
    Could anyone explain how to apply either of those to this particular problem?

    I really would appreciate any help I can get with this, as it's driving me crazy!

  2. #2
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Maths Problem

    Take at the MoveIt object (or the move by breezier curve to add acceleration).

Similar Threads

  1. maths help expression
    By Bigfoot in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 8th March 2011, 02:51 PM
  2. parabolla maths example in MMF
    By arfa in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 8th November 2010, 08:33 PM
  3. Maths Equation
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 17th March 2010, 11:16 PM
  4. bit of a maths help if anyone can?
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 17th August 2009, 02:54 PM
  5. Decimals and Maths
    By IsaacBoy in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 8th November 2006, 02:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •