User Tag List

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

Thread: Finding the distance between 2 identical objects

  1. #1
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA 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)
    gkinfinity's Avatar
    Join Date
    May 2011
    Location
    USA
    Posts
    282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Finding the distance between 2 identical objects

    Hi, I'm new to the forums. I was just wondering if anyone could provide a way to find the distance between 2 identical objects.

    In other words, if you create an active object and then duplicate it, how can you find the distance between them since they are the same object?

    What I want to be able to do eventually is have an object which is duplicated 10 times where the copies are moved to different random locations and find the distance between object 1 and 2, then 2 and 3, then 3 and 4 (etc.) until it calculates the distance from 9 to 10 (where each distance is stored separately).

    Thanks

  2. #2
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, ┼rhus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Finding the distance between 2 identical objects

    In one event you have to pick out object 1, store its coordinates in two counters. Then pick out object 2 and find its distance to the position stored in the counters - store the position of instance 2 in the counters - find instance 3 - and so on... You can even do this in a fastloop for any number of instances of objects you have.

  3. #3
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA 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)
    gkinfinity's Avatar
    Join Date
    May 2011
    Location
    USA
    Posts
    282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding the distance between 2 identical objects

    It was an easy problem but I was just trying to get it all done in one event instead of splitting it up into 2 events and recording the coordinates separately. I guess I was just hoping to avoid having to use counters and get it all done with alterable values. Don't know why I didn't think of that though. Thanks!

  4. #4
    Clicker Multimedia Fusion 2 DeveloperAndroid Export Module

    Join Date
    May 2010
    Posts
    163
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding the distance between 2 identical objects

    Andos, could you elaborate on the solution for this? I think I may be able to use it for a similar problem I'm having with actives that are grouped by a qualifier.

  5. #5
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA 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)
    gkinfinity's Avatar
    Join Date
    May 2011
    Location
    USA
    Posts
    282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Finding the distance between 2 identical objects

    He can probably give a better explanation, but here's a simple version of what I did to figure out my specific problem (finding distances).

    So say you start off with a bunch of identical objects.

    -Start of frame
    +Spread value (so they can be identified separately)(I actually don't know if I've ever used spread value for all items grouped under a qualifier but I'm assuming it works)

    -Have some event that starts a loop X number of times (where X is the number of objects you have minus 1)

    -On loop if Alterable Value of Object = Value of Loop Counter
    +Set X1 counter to X coordinate of Object
    +Set Y1 counter to Y coordinate of Object

    -On loop if Alterable Value of Object = Value of Loop Counter + 1
    +Set X2 counter to X coordinate of Object
    +Set Y2 counter to Y coordinate of Object

    At this point you will have the coordinates for the first 2 identical objects. Next have some event which calculates the distance via the distance formula and save it in whatever manner you want. Then have an event that adds 1 to the Loop Counter and the loop will start again. Since the Loop Counter is 1 higher it will look at object 2 and 3 instead of 1 and 2. It will continue until all distances have been determined.

    Hopefully that's not too hard to follow.

  6. #6
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Could someone please elaborate on the above? I've followed gk's steps but end up with a huge mess...

  7. #7
    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)
    You'll need to explain what it is you don't get. He sort of elaborated it in his post. :P

  8. #8
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    So, I did everything in the post and the bits that weren't explained in code I assumed were:

    Always:
    --> set distance(altvar) to (distance btw x1/y1, x2/y2)
    --> set loopindex("loop") to loopindex("loop")+1

    but this does not work. Also how do I extract the distance if I want to use it? Is this done within the loop?

  9. #9
    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)
    You could save the distance between two objects into a global value if you wanted to, and then use those results however you'd like (outside of the fast loop)

    Yes, setting the loop index to +1 would be done within the loop. This way it would run the loop like:
    0,2,4,6,8

    and it would be comparing objects 0 and 1, 2 and 3, 4 and 5, 6 and 7, 8 and 9

  10. #10
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Doing this with the ForEach extension doesn't seem to work (add 1 to Current Iteration within the loop), but I'll try it with normal loops.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Distance between 2 objects
    By qenio in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 26th June 2012, 09:12 AM
  2. Finding Distance
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 4th April 2010, 05:08 AM
  3. Activating 1 object out of many identical objects?
    By camelman in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 16th November 2008, 04:42 PM
  4. Advanced Movement Object: Finding Distance
    By Gerblegod7 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 20th April 2007, 04:32 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
  •