Professional Web Applications Themes

get the model number - Macromedia Director 3D

How do you get hold of the model number ive clicked on- heres the code ive worked on so far- just got the last part to figure out. Got a feeling this one is obvious and staring me in the face. ------ calculate the click location upperLeft = point(sprite(1).left, sprite(1).top) clickLocation = the mouseLoc - upperLeft ------ get the model there if sprite(1).camera.modelUnderLoc(clickLocation) = false then nothing else model = sprite(1).camera.modelUnderLoc(clickLocation) ------ send to message window (THE MODEL NUMBER) put model.model[index] ?????...

Sponsored Links
  1. #1

    Default get the model number

    How do you get hold of the model number ive clicked on- heres the code ive
    worked on so far- just got the last part to figure out. Got a feeling this one
    is obvious and staring me in the face.

    ------ calculate the click location
    upperLeft = point(sprite(1).left, sprite(1).top)
    clickLocation = the mouseLoc - upperLeft

    ------ get the model there
    if sprite(1).camera.modelUnderLoc(clickLocation) = false then
    nothing
    else
    model = sprite(1).camera.modelUnderLoc(clickLocation)

    ------ send to message window (THE MODEL NUMBER)
    put model.model[index] ?????

    Sponsored Links
    otterman Guest

  2. #2

    Default Re: get the model number

    the model's index number isn't a property of the model itself. the w3d member
    has an array of models that can be accessed either by name or index. using name
    is better because adding or deleting models will change the index number of all
    models. just because the model you click on is index number 4 at the time
    doesn't mean it will always be. but, if you really need the number you could
    loop through the models and see which index number is the one with the name of
    the clicked model. i use javaScript now so my lingo's rusty, but it would be
    something like:

    ------ calculate the click location
    upperLeft = point(sprite(1).left, sprite(1).top)
    clickLocation = the mouseLoc - upperLeft

    ------ get the model there
    if sprite(1).camera.modelUnderLoc(clickLocation) = false then
    nothing
    else
    model = sprite(1).camera.modelUnderLoc(clickLocation)

    repeat with n = 1 to sprite(1).member.model.count
    if sprite(1).member.model[n].name = model.name then
    ------ send to message window (THE MODEL NUMBER)
    put n
    end if
    end repeat



    Ex Guest

  3. #3

    Default Re: get the model number

    Hey, thats bang on! works a treat!

    Your lingos alot more adapt than mine. I too abandoned Director for a while
    fearing its gonna go the way of the dodoo!
    Thanks for you solution to my very niggling problem.

    Ta

    otterman Guest

  4. #4

    Default Re: get the model number

    glad that helped.

    i meant that i use javascript syntax instead of lingo in director by the way, not javascript instead of director.
    Ex Guest

Similar Threads

  1. New release of Config::Model with fstab model example
    By Dominique Dumont in forum PERL Modules
    Replies: 0
    Last Post: May 22nd, 12:08 PM
  2. Move model over the others model in the scene
    By vgta in forum Macromedia Director 3D
    Replies: 2
    Last Post: August 8th, 07:32 AM
  3. model showing in 3d editor but not in castmember model list
    By Gianpiero Colagiacomo in forum Macromedia Director 3D
    Replies: 1
    Last Post: May 6th, 02:05 AM
  4. Problem picking model under another model
    By Bazmati webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 5
    Last Post: October 6th, 12:37 PM
  5. Model within model transform.position, intersection, overlapping models
    By Zafada webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 0
    Last Post: August 30th, 12:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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