Professional Web Applications Themes

How to get a model from a group - Macromedia Director 3D

Hi I'm doing a 3D project in Director using Javascript. I have to 3D members. a "world" and a "content". I dynamically copy groups from the content to the world. The groups i copy contain models which make up chairs. I'm doing something like: member("world").cloneModelFromCastmember("chair1", chair, member("content")); member("world").cloneModelFromCastmember("chair2", chair, member("content")); Now I need to set the texture of the seat of each chair to a new texture. How do I access the "seat" model which is inside the chair1 group in the world member? Please answer even if you just have a hint. Jakob...

Sponsored Links
  1. #1

    Default How to get a model from a group

    Hi

    I'm doing a 3D project in Director using Javascript.

    I have to 3D members. a "world" and a "content". I dynamically copy groups
    from the content to the world. The groups i copy contain models which make up
    chairs.

    I'm doing something like:

    member("world").cloneModelFromCastmember("chair1", chair, member("content"));
    member("world").cloneModelFromCastmember("chair2", chair, member("content"));

    Now I need to set the texture of the seat of each chair to a new texture. How
    do I access the "seat" model which is inside the chair1 group in the world
    member?

    Please answer even if you just have a hint.

    Jakob

    Sponsored Links
    Jakob Guest

  2. #2

    Default Re: How to get a model from a group

    Here is som more details. The 3d members are now called "world" and "testScene".

    My full script look like this:

    function startMovie()
    {
    initScene();
    }
    function initScene()
    {
    member("world").resetWorld();
    member("testScene").resetWorld();
    sprite(1).antiAliasingEnabled = true;
    member("world").cloneModelFromCastmember("chair1", "chair",
    member("testScene"));
    member("world").cloneModelFromCastmember("chair2", "chair",
    member("testScene"));
    var m1 = getModel("chair1", "world");
    var m2 = getModel("chair2", "world");
    m2.transform.position=vector(10,0,0);//moves the one group so both are
    visible

    // tries to get the seat model which is inside the chair1 group
    trace(m1.seat) // Returns: [function seat]
    //trace(m1.getProp("model", "seat")) // ERROR: Handler not defined
    //trace(m1.getProp("model", 1)) // ERROR: Handler not defined
    trace(m1.getPropRef("model", 1)) // Returns: <model("chair1")>

    }
    //
    // getModel
    //
    function getModel(modelName, memberName)
    {
    for (var i = 1; i <= member(memberName).count(symbol("model")); i++)
    {
    if ((member(memberName).getProp("model",i).name) == modelName)
    {
    return member(memberName).getProp("model",i);
    break;
    }
    }
    }

    Hope you can help.

    Jakob Guest

  3. #3

    Default Re: How to get a model from a group

    Hy,

    This is how you select (with lingo) a model from inside a group:

    member("world").group("chair1").model("seat")

    daniel.
    danieloizo Guest

  4. #4

    Default Re: How to get a model from a group

    cloneModelFromCastmember clones models, not groups. If the "chair1" model has a
    Director-child model named "seat", then it will clone. But if you created
    "seat" in your modeling software and grouped it there (3dsmax), then "seat"
    will become a sub-mesh of chair. If so, you can set the shaderlist[x] property
    of the chair model, where x is the submesh index of the seat submesh. You just
    have to figure out what x is.

    tedalde2 Guest

  5. #5

    Default Re: How to get a model from a group

    .... true, to figure x out, you can use 3DPI, it's a very useful tool!
    danieloizo Guest

Similar Threads

  1. New release of Config-Model, first draft for Xorg model
    By Dominique in forum PERL Modules
    Replies: 2
    Last Post: September 24th, 03:22 PM
  2. 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
  3. 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
  4. 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
  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