User Tag List

Results 1 to 4 of 4

Thread: Making "magnet" event?

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Making "magnet" event?

    I need an event for when a falling object (bouncing ball movement) comes close to another object it should get "draged" toward that other object a bit like a magnet. I have tried some events like when X and Y position is equal or closer then look at object that they should drag toward, but i have not really got it to work like i want.

    How can i do this event?

  2. #2
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2007
    Location
    Poland
    Posts
    232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making "magnet" event?

    You can use tangent x / y to get angle between two objects and nextly move it by sin() and cos() directly to dragging object.

    To get distance between two object, you can use advanced math object, or use Pythagorean formula.

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making "magnet" event?

    It would be much easier if you were using a vector movement instead of bouncing ball, then you could use standard point gravity formulas.

    You'd just add 10 / the difference in x position (x position("magnet") - x position("object")) to the x speed, and same for the y. The 10 is a tunable strength. Technically you should pow 2 (gravity) or even pow 3 (magnetism) the difference in position, but games are about results that look good rather than being physically accurate.

    EDIT: Actually that's not quite right. Hmm.

  4. #4
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making "magnet" event?

    Do you have a copy of Snippet Manager? It has lots of neat math solutions. Try: snippetmanager.net

    Also ParticleSpray has a magnet funtion - which I have yet to work with.

Similar Threads

  1. Help! - Multiple "Which animation is playing?" Conditions in same event line.
    By ezzypixel in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 15th October 2013, 02:18 AM
  2. "Brushing away" an image, making the brush stroke transparent?
    By Tiny in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 1st October 2012, 12:37 PM
  3. Adding Return to "Change alterable Text" event
    By Teh_Purple_d00d in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th December 2011, 01:45 AM
  4. Event Editor: Little "B" in bottom-left corner of my objects
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 12th December 2011, 08:08 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
  •