User Tag List

Results 1 to 8 of 8

Thread: Help with arcing projectile

  1. #1
    Clicker 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
    Nov 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with arcing projectile

    I'm trying to have a projectile similar to the video here:

    https://www.youtube.com/watch?v=-FqbG8zm6xs

    User clicks a spot, projectile spawns at an origin position, moves through an arc at a given speed, then hits the target, proceeding along the arc if the target is above the ground. It needs to be extremely accurate at hitting the target.

    I have two ideas on how to do this. First, I have the origin, the target, and the apex could be the top of the screen halfway between the two, then using the three points to calculate a circle and use that to somehow calculate the next position of the projectile. Second was to use Bezier.

    For some reason my brain is melting trying to proceed on this. Anyone have any ideas?

  2. #2
    Clicker Fusion 2.5Android Export Module

    Join Date
    Sep 2010
    Posts
    536
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This might be a somewhat stupid idea but me and math doesn't mix very well haha but maybe you could place some hidden objects between the launch and the target. Place them so that they form an arc/ halfcircle and always make the launched object look at 0,0 at those invisible objects and destroy them when the object collides with them..then lastly make it look ay 0,0 at the actual target and have a ball movement on the bullet.

    Like I said...it might be stupid but i just thought it MIGHT work. Schrodinger! come here and clean up my mess with a proper solution haha!!!

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    aenever's Avatar
    Join Date
    Jun 2013
    Posts
    1,413
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    Clicker 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
    Nov 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aenever View Post
    That's a great example, thanks!

    The real problem I'm having is that it absolutely needs to be spot on accurate to where the user clicked. I think I'm going to try to adapt goo.gl/XrMcoV but it's going to be a pain.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    ahah Klownzilla

    yeah I think a math solution can help by predicting target hitting point with precision
    but credits go to Wikipedia, I've simply plugged the equation found here

    assuming your projectile flies at constant speed (acceleration / moving target might complicate things a lot!)

    here's quick example:

    projectile_trajectory.mfa

    you can change projectile speed and gravity pull in crosshair object

    notice a couple things:

    1) there are two valid solutions (launch angles) to the equations,
    you can switch them with the button on top, faster solution will go "straighter" while slower will arch more
    you can think of using the fast one for nearest targets, and the other for farther.
    I think better results come with bigger playfields

    2) there might be no valid solution for every coordinate on screen!
    A target might be too high or too far if the projectile has not enough speed / gravity is too strong,
    in this case the string on top will output -1#.IND (otherwise it simply tells you the firing angle)

    I've added a bit of more code to make the arrow arch following the trajectory, hope it helps


    ***
    edit - just read your latest post, I've used the same source

  6. #6
    Clicker 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
    Nov 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by schrodinger View Post
    ahah Klownzilla

    yeah I think a math solution can help by predicting target hitting point with precision
    but credits go to Wikipedia, I've simply plugged the equation found here

    assuming your projectile flies at constant speed (acceleration / moving target might complicate things a lot!)

    here's quick example:

    projectile_trajectory.mfa

    you can change projectile speed and gravity pull in crosshair object

    notice a couple things:

    1) there are two valid solutions (launch angles) to the equations,
    you can switch them with the button on top, faster solution will go "straighter" while slower will arch more
    you can think of using the fast one for nearest targets, and the other for farther.
    I think better results come with bigger playfields

    2) there might be no valid solution for every coordinate on screen!
    A target might be too high or too far if the projectile has not enough speed / gravity is too strong,
    in this case the string on top will output -1#.IND (otherwise it simply tells you the firing angle)

    I've added a bit of more code to make the arrow arch following the trajectory, hope it helps


    ***
    edit - just read your latest post, I've used the same source
    Wow, this is perfect. Thank you so much!

  7. #7
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    618
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    @schrodinger I love this example! Is it possible to change the equation so it shoots from right to left aswell?

  8. #8
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    618
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Thanks to @Sumo 148 here it is projectile_trajectory_left.mfa

Similar Threads

  1. Set direction for each projectile once.
    By harr18 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 16th November 2015, 10:00 AM
  2. how to: flashing, arcing neon light
    By arfa in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 25th August 2011, 12:50 AM
  3. Beam Projectile?
    By Pixzel in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 10th August 2010, 11:02 PM
  4. Help lobbing a projectile
    By mobichan in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 22nd January 2010, 04:32 PM
  5. Targeted projectile flying a curve
    By Random in forum File Archive
    Replies: 9
    Last Post: 7th January 2009, 02:46 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
  •