measure distance of 2 or more 3d object

Ask a Question related to Macromedia Director 3D, Design and Development.

  1. #1

    Default measure distance of 2 or more 3d object

    hi,
    i need to measure the distance between 2 or more 3d objects and give warning if the distance is less then 60 cm.
    can anyone tell me how to do this?

    thanks
    =Mike=
    just_mik3 Guest

  2. Similar Questions and Discussions

    1. how to measure the streaming bandwidth
      hi We are hosting a Media Server applications on our server, we wanna measure the bandwidth the application consume. so, please could any one tell...
    2. measure the height of a model
      how can i measure the height of a model?
    3. Measure space of surface
      how can i measure how many space of a plain surface remains if i put a model on it? regards, mike
    4. snap distance > pick distance impossible?
      In the General Preferences, I tried to set the value for the pick distance to 1, and the snap distance to 5, but after several tries (and thinking...
    5. Measure Ink Coverage
      I would like to know if Illustrator or Photoshop can calculate the amount of ink coverage a particular image or letter will use as compared to...
  3. #2

    Default Re: measure distance of 2 or more 3d object


    v1 = member("scene").model("modelName1").worldPosition. duplicate()
    v2 = member("scene").model("modelName1").worldPosition. duplicate()
    dist = v1.distanceTo(v2)

    if dist < 0.6000 then

    put "warning"
    -- Insert warning code here

    end if

    Be careful to not use distanceTo() in a repeat while or in a repeat with or
    in an on enterFrame or in an on exitFrame script as it implies heavy
    calculation.

    Cheers,
    Karl.


    Karl Sigiscar Guest

  4. #3

    Default Re: measure distance of 2 or more 3d object

    v2 = member("scene").model("modelName2").worldPosition. duplicate()


    Karl Sigiscar Guest

  5. #4

    Default Re: measure distance of 2 or more 3d object

    hi karl,
    you said not to use distanceTo() in a repeat loop. do you know a faster way to
    calculate the distance between two object?
    i need something that checks the distance of many objects in a repeat loop.

    hondo3000 Guest

  6. #5

    Default Re: measure distance of 2 or more 3d object

    Actually, the technique I use is to call distanceTo() on enterFrame or on
    stepFrame ONLY ONCE OR TWICE EVERY SECOND. I compare the current ticks with
    the previously saved ticks to check time everytime I reenter the frame. If a
    certain amount of time has elapsed, I check the distance.

    If you call distanceTo() everytime the playhead reenters the frame, it slows
    things down very much.

    Cheers,
    Karl.


    Karl Sigiscar Guest

  7. #6

    Default Re: measure distance of 2 or more 3d object

    If you do it on a repeat with loop, it clogs up the CPU.


    Karl Sigiscar Guest

  8. #7

    Default Re: measure distance of 2 or more 3d object

    than'x
    i'll try it right away.
    just_mik3 Guest

  9. #8

    Default Re: measure distance of 2 or more 3d object

    Karl -
    2 things came up in my head, seeing this thered:

    1. why do you have to duplicate the objects transform, in order to calculate
    the distance bitween them?

    2. wouldn't actually calculating the transform, with real math be faster?

    bgsBS Guest

  10. #9

    Default Re: measure distance of 2 or more 3d object

    1. It's not necessary in this case indeed but it does no harm. I'm used to
    duplicating so as to use the transform data rather than a reference to the
    transform. Otherwise, you might modify the original transform unwittingly
    and it might be the cause of a bug in your program.

    2. As every Lingo instruction, distanceTo() is a wrapper to a C++ function.
    Everything written in C++ is faster than anything you can come up with
    written in Lingo.


    "bgsBS" <webforumsuser@macromedia.com> a écrit dans le message de news:
    d3qiiv$1db$1@forums.macromedia.com...
    > Karl -
    > 2 things came up in my head, seeing this thered:
    >
    > 1. why do you have to duplicate the objects transform, in order to
    > calculate
    > the distance bitween them?
    >
    > 2. wouldn't actually calculating the transform, with real math be faster?
    >

    Karl Sigiscar Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139