User Tag List

Results 1 to 4 of 4

Thread: Smooth direct motion.

  1. #1
    Gibdo beefster09's Avatar
    Join Date
    Mar 2006
    Age
    31
    Posts
    699
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,710
    Level
    16
    vBActivity - Bars
    Lv. Percent
    97.39%

    Smooth direct motion.

    How do I make an object that moves directly towards a target in a Pythagorean-theorem-style speed? So instead of having a max in each direction, it would have a max in literal speed. So an object would travel at x degrees toward an object with z speed instead of moving in the 8 cardinal directions, being less direct.

    Sorry if I've confused you, I got it from genetics.
    Avatar: Just who the SPAAAACE do you think I am?

  2. #2
    Lynel Revfan9's Avatar
    Join Date
    Jun 2005
    Location
    In front of a screen. I never leave.
    Age
    31
    Posts
    1,160
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,390
    Level
    18
    vBActivity - Bars
    Lv. Percent
    71.05%

    Re: Smooth direct motion.

    Hmm...

    Not tested, but here is the way I think it could work.

    Say that the FFC is at position 10,10 and the point you want to go to is 17,-8

    10+8=18
    10-17=-7

    18/-7=-2.5714285714285714285714285714286

    xspeed=1
    yspeed=-2.5714285714285714285714285714286

    Again, not sure if it will work, and it will be more difficult because the X/Y positions work as absolute values in the 4th quadrant, and negative values will almost never be used...

    But try to build from that...

    Or, as an alternate method, you could judge whether the position of the point is left/right/up/down and move accordingly. This script will not only follow a moving FFC, but it will also move in a straight line torwards a point.

  3. #3
    Gibdo beefster09's Avatar
    Join Date
    Mar 2006
    Age
    31
    Posts
    699
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,710
    Level
    16
    vBActivity - Bars
    Lv. Percent
    97.39%

    Re: Smooth direct motion.

    I have an idea. It involves approximating ratios like what you suggested and bringing them down to size using the distance formula. (gee, I never knew my limited geometry knowledge would be this helpful!)
    Avatar: Just who the SPAAAACE do you think I am?

  4. #4
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.07%

    Re: Smooth direct motion.

    Yeah, that's pretty much it. It's basically xVel=speed*xDist/totalDist and yVel=speed*yDist/totalDist.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social