Professional Web Applications Themes

question! plz help - Macromedia Director 3D

ok what i tried to do is this, i have a model of a galil rifle i made, and the model is devided into different elements, i want to be able to address each element seperatly in the code but i dont know how to, using the member.model method address the whole model, another thing i tried to to is to devide the model into seperate groups in the 3D program and export it as a W3D file, my plan was to clonemodelfromcastmember them all and put them in a list, i think it worked fine cuz the put(list) command ...

  1. #1

    Default question! plz help

    ok what i tried to do is this, i have a model of a galil rifle i made, and the
    model is devided into different elements, i want to be able to address each
    element seperatly in the code but i dont know how to, using the member.model
    method address the whole model, another thing i tried to to is to devide the
    model into seperate groups in the 3D program and export it as a W3D file, my
    plan was to clonemodelfromcastmember them all and put them in a list, i think
    it worked fine cuz the put(list) command actually details all the models in the
    scene, the problem is that i cant see anything in the shockwave window itself!
    this was kinda hard to explain so il just put the code here
    also heres the model and the director file, if anyone wanna get down and dirty
    plz help! thanks!

    http://www.planetnana.co.il/pyro-ct/galil.zip



    property my,m,mr
    property i,e


    on tran lis,u,v,w
    repeat with i = 1 to count(lis)
    lis[i].translate(u,v,w)
    end repeat
    end




    on beginsprite me
    my = sprite(me.spritenum)
    my.member.resetworld()

    mr = [] --model resource
    m = [:] --models list

    e=member("galil").model.count

    repeat with i = 1 to e
    mr.add (member("galil").modelresource[i])
    m.addprop (#"model "& i , my.member.newmodel("model " & i , mr[i]))
    end repeat

    put (mr)
    put (m)

    tran(m,0,0,0)
    end




    Pyro-ct Guest

  2. #2

    Default Re: question! plz help

    plz ignore the trans function there, its not relevant now
    Pyro-ct Guest

  3. #3

    Default Re: question! plz help

    Do you have any lights in the W3D scene that is on stage? That would
    certainly explain why you are not seeing anything...
    Mike Guest

  4. #4

    Default Re: question! plz help

    realy? but so far i never changed the default light and it allways worked
    dunno why it dosnt work now, i tried to add light but its still all dark

    Pyro-ct Guest

  5. #5

    Default Re: question! plz help

    just use the following piece of script:


    global w,s

    on beginsprite me
    w = member("world")
    w.resetworld()
    s = member("galil-broken")
    mc = s.model.count
    --w.camera(1).transform = s.camera(1).transform
    repeat with i = 1 to mc
    mn = s.model[i].name
    w.cloneModelFromCastmember(mn, mn, s)
    end repeat
    end

    necromanthus Guest

  6. #6

    Default Re: question! plz help

    [q]Originally posted by: Pyro-ct
    ok what i tried to do is this, i have a model of a galil rifle i made, and the
    model is devided into different elements, i want to be able to address each
    element seperatly in the code but i dont know how to, using the member.model
    method address the whole model
    [/q]

    It's worth bearing in mind that some 3d modelling applications (3ds max in
    particular) will actually condense a group of objects down to a single object
    when exporting to w3d. Therefore a group of objects called 'rifle group', which
    contains 10 models, might be exported as a single model called 'rifle
    group'.

    To preserve your model compents within the group, you'll need place each
    individual component into its own group, and then group them all together.
    Grouping each model individually (so that each model is a "group of one")
    before grouping them as a whole, will prevent the exporter from collapsing all
    into a single mesh

    - Ben




    duckets Guest

  7. #7

    Default Re: question! plz help

    well i did, the w3d file is composed of several models that have different names
    it all "seems" to work, the list is filled with models references and names
    just fine, the only problem is that whene i run the movie they dont show

    is there a way to maybe address different elements of each model?

    Pyro-ct Guest

  8. #8

    Default Re: question! plz help

    [q]Originally posted by: Pyro-ct
    well i did, the w3d file is composed of several models that have different
    names
    it all "seems" to work, the list is filled with models references and names
    just fine, the only problem is that whene i run the movie they dont show[/q]

    That's because your script doesn't clone anything.
    Besides that, those 2 arrays are a waste of resources (RAM in this case). You
    don't need them at all.
    You can access at runtime any model, any resource and any property without
    those (text) lists.
    Anyway, if you need badly those arrays, here is the complete (and
    working !) script:



    global w,s,mr,md

    on beginsprite me
    w = member("world")
    w.resetworld()
    s = member("galil-broken")
    mr = []
    md = []
    mc = s.model.count
    --w.camera(1).transform = s.camera(1).transform
    repeat with i = 1 to mc
    mri = s.model[i].resource.name
    mdi = s.model[i].name
    w.cloneModelFromCastmember(mdi, mdi, s)
    mr.add(mri)
    md.add(mdi)
    end repeat
    put mr
    put md
    end

    necromanthus Guest

  9. #9

    Default Re: question! plz help

    Having looked at your code more closely, your problem appears to be that you
    are trying to use a 'model resource' from one scene, as the resource for a new
    model in another. Resources can't shared across 3d cast members like this. To
    clone a model from one scene into another (which therefore also clones the
    model's resource), you need to use "cloneModelFromCastMember".

    Here's how I would modify your code to make it functional (attached below).

    Things to note:

    I have called 'preload' on the source scene (the scene we are cloning
    [i]from[/i[). Otherwise, because this 3d cast member does not appear on stage,
    it won't yet be loaded into ram, and will cause an error when attempting to
    clone.

    When using cloneModelFromCastmember, you have to specify the source model by
    name, so I have added this code to your loop. You could also use this
    'sourceModelName' as the name for each new model. This way, the models in your
    destination scene would have the same names as the models in the source scene,
    instead of 'model 1' 'model 2' etc.

    A couple of small things:
    You didn't need to declare 'i' and 'e' as properties, since you were only
    using them locally in scope. For example, you didn't need to remember the
    values for 'i' and 'e' when the handler finishes.

    Your 'tran' function seems to simply translate a list of objects, which kind
    of tes the purpose of 'group' nodes in the 3d scene, in a slower
    fashion. If you want to translate (or manipulate in any way) a group of models,
    simply create a group object (using lingo: newGroup) and set each model's
    "parent" property to that group. You can than translate the group and all
    objects will move along with it.

    hope this helps!

    - Ben



    property my,m

    on tran lis,u,v,w
    repeat with i = 1 to count(lis)
    lis[i].translate(u,v,w)
    end repeat
    end

    on beginsprite me
    my = sprite(me.spritenum)
    scene = my.member
    scene.resetworld()

    m = [:] --models list

    sourceScene = member("galil-broken")
    sourceScene.preload()

    repeat with i = 1 to sourceScene.model.count
    sourceModelName = sourceScene.model[i].name
    newModelName = "model "&i
    clonedModel = scene.cloneModelFromCastmember(newModelName,
    sourceModelName, sourceScene )
    m.addprop(newModelName,clonedModel)
    end repeat

    put (m)

    tran(m,0,0,0)
    end

    duckets Guest

  10. #10

    Default Re: question! plz help

    oh now i see.. now that i think of it i dont know why i didnt use
    clonemodelfromcastmamber in the first place
    maybe im just going into the deep water too soon
    gotto learn more basic stuff first

    thanks for the help!

    Pyro-ct Guest

Similar Threads

  1. Newbie Question: Biz Card Template Question
    By Thomas_Porter@adobeforums.com in forum Adobe Indesign Windows
    Replies: 4
    Last Post: May 30th, 08:08 AM
  2. Replies: 9
    Last Post: April 27th, 04:44 AM
  3. Pen Tool Use Question. (Embarrassingly Newbie Question)
    By Bozo Schmozo in forum Macromedia Flash
    Replies: 0
    Last Post: November 12th, 10:00 PM
  4. Global variable question question
    By Jason Giangrande in forum PHP Development
    Replies: 3
    Last Post: July 23rd, 08:27 PM
  5. newB question: related tables question
    By Blue man in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: June 30th, 04:13 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