User Tag List

Results 1 to 7 of 7

Thread: Predicting X ( point of impact )

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Predicting X ( point of impact )

    Hi
    I Have a moving Ball Object.
    This is known about the Ball:
    - Its starting coordinates ( X and Y )
    - Its Angle ( 360 )
    - Its speed ( pixels moved in direction of Angle per Frame )

    Eveything above Y possition 380 in the Frame is ground level.

    Given this data, how would i be able to make up a formula to predict at what X coordinate along the ground level the Ball will be impacting?
    If i knew where to start with this i woulden't ask :P

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I'm pretty terrible at math so I can't really come up with the formula for that on the spot...

    My trick would be to create an invisible ball object identical to the visible one, and then have it hit the target quickly to determine where the visible ball object would hit.

  3. #3
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    1,062
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    its just a trig question;
    heres a link to demonstrate how to find the answer you are looking for: http://www.mathwarehouse.com/trigono...-practice3.php

    in your case, you just need to know how far up from the ground the ball is (ground Y - ball Y)
    and the angle it travels.
    from those 2 pieces of info, you can determine how far it will travel (x) before reaching the ground. add or subtract that amount from the balls original X will give you the X point on the ground.

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    In other words...
    X - ((380 - Y) * (cos(angle) / sin(angle)))

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK so..

    Ball Xpos - Ball Y distace from Ground * (cos(angle) / sin(angle)

    ...
    (cos(angle) / sin(angle)???

    Why do i do this?

  6. #6
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    To get the gradient of the straight line along which the ball is moving. Obviously the ball's speed is irrelevant.

    For every 1 pixel the ball moves down, it moves "cos(angle) / (-1 * sin(angle))" pixels to the right (the -1 part is because of MMF2's inverted y-axis). You know how many pixels down the object needs to move (obviously it's 380 - Y), so you can just multiply the two together to find out how far to the right the ball needs to move. And once you know how far right it's going to move from its starting point, you simply need to add the X position where it started.

    If you subtract from X instead of adding to it, you don't need the "-1 * " part - it just makes the formula a bit neater.

  7. #7
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome it works!
    Thank you so much MuddyMole!

Similar Threads

  1. Predicting Tartget Speed
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 2nd May 2013, 09:28 AM
  2. Multiple impact problem
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 30
    Last Post: 10th April 2013, 06:07 PM
  3. Predicting X ( point of impact ) 2
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 1st June 2012, 11:25 PM
  4. Chipmonk Physics Impact Angle
    By Kalnar in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 16th February 2008, 09:29 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
  •