User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Point of contact between two objects?

  1. #1
    No Products Registered

    Join Date
    Jan 2013
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Point of contact between two objects?

    I'm building a dumb physics engine (who isn't?) and it would be really handy to know the point of contact between two objects when they collide. Objects of varying sizes and shapes hitting at various angles and offsets.

  2. #2
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,782
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    It depends on whether Fine Collision is checked or not in the object properties. Available for active objects only. If checked, the collisions with this object and the others will be pixel precise (transparent areas do not trigger a collision). If unchecked, the collision will be done in box mode, with the rectangular box that surrounds the object.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  3. #3
    No Products Registered

    Join Date
    Jan 2013
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I'm after is the X and Y location of the point of contact. Is there a way to retrieve or calculate this information?

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC

    Join Date
    Jul 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    isn't where you've set the action and hot spot of your active objects?

  5. #5
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)
    BackStaged's Avatar
    Join Date
    Aug 2010
    Location
    France
    Posts
    693
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it exists a way, a proof-of-concept (at least).

    Preparation: create an object (Active per example) with 2 variables (value type) named: "posXIs" and "posYIs" and one string variable named "checkState", put default to "WaitForOrder"

    First: Give to your object a Qualifier (eg: Collectables)

    Second: Create all Collectables objects by the method: Create Object!

    In an event group named "_CheckPosition_":
    Third:
    If checkState is equal to "WaitForOrder"
    Check Position condition for evaluating DISTANCE of the object which have "Collectables" Qualifier.
    Stock X,Y position in Local Object variables (value type) : eg: "posXIs=%X_POS%", "posYIs=%Y_POS%"
    Set checkState to the value "NowCheck" when checked for the checked object (DO NOT USE Qualifier here, or all objects will have value "NowCheck" if Qualifier is same, like "Collectables"!).
    Repeat unless ALL Collectables are checked.

    Four:
    If checkState is equal to "NowCheck"
    Check position of the object related to the PLAYER coordonates (X, Y)
    When done, set checkState to the value "NearFrom"

    Five:
    If checkState is equal to "NearFrom"
    -- do your actions.
    After all actions are finished, set the checkState to the value "WaitForOrder" -so as it the check will be restarted!

    if for any reason you must disable the check (eg: powerup which make the player unreachable), you would like then disable simply the event group named: "_CheckPosition_"

  6. #6
    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)
    Tauman I understand what it is you're asking. The short answer is: No.

    The long answer is: Really anything is possible... It depends on the size of your objects and shape and whatnot... If the objects are literally all circular, you could in fact use distance from the two object's centers in order to figure out the point between the two. But this is unlikely your situation... If you have odd shaped objects then you'd need to do something intensive like running a 1 pixel active in a big fastloop that places the 1 pixel active in a grid pattern near the central point of the two objects (figured by the distance between the two object's centers)

    Then you'd have a condition in the fastloop to check if that 1 pixel active is overlapping both of your colliding objects at the same time... This means that 1 pixel active is directly at a point of overlap between the two objects. Then you'd stop the fastloop and use the x,y of that 1 pixel active as your contact position.

    However I can't see this being very efficient...

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Konidias I though about same idea, and it could be efficient only IF the loop will be started during collision. In manner On collision run the loop to verify distance between 2 objects and move it from there to find a place where it overlaps both objects.

  8. #8
    Clicker Multimedia Fusion 2 DeveloperAndroid Export ModuleSWF Export Module
    pzazz's Avatar
    Join Date
    Mar 2011
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you go about it with a kind of X Y targeting scope? What I mean is:
    on collision with object- create an invisible line the width of the object at the base and create a line the height of the object at the side- these lines zip upwards and to the right,
    where the two lines and the colliding object all overlap you have a coordinate.
    this may be a little slow but it might be doable with fastloops...

  9. #9
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Pineapple's Avatar
    Join Date
    Oct 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Somehow, I have the feeling that this could be accomplished by comparing the angle and distance between object 1 to object 2... but I haven't tried this, so I could be wrong.

  10. #10
    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)
    Quote Originally Posted by Pineapple View Post
    Somehow, I have the feeling that this could be accomplished by comparing the angle and distance between object 1 to object 2... but I haven't tried this, so I could be wrong.
    But this would only work with two round objects... If you need pixel perfect detection you'd have to use another solution.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Formulaire de contact
    By jose in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 30th November 2012, 08:06 PM
  2. Formulaire de contact
    By jose in forum File Archive
    Replies: 4
    Last Post: 29th November 2012, 08:02 AM
  3. Rotating objects around a point
    By Raylax in forum File Archive
    Replies: 14
    Last Post: 29th December 2008, 12:17 AM
  4. Rotating objects around a point
    By Raylax in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 24th December 2008, 05:56 PM
  5. Replies: 17
    Last Post: 16th July 2006, 02:02 AM

Posting Permissions

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