Professional Web Applications Themes

cloneModelFromCastMember help - Macromedia Director 3D

Salutations! I'm trying to take a model from one Shockwave 3D object and put it in another. Using cloneModelFromCastMember I've got it to the point where in debug mode, I can verify that my destination cast member has all the same modelResource and model properties, all the same shaders and textures as the source, yet nothing displays in the 3d window. I also attempted to copy light settings and camera settings, and I have a fairly high confidence level that the values are what they should be (again, I can see them when debugging). The only oddity, which I think ...

  1. #1

    Default cloneModelFromCastMember help

    Salutations!

    I'm trying to take a model from one Shockwave 3D object and put it in another.
    Using cloneModelFromCastMember I've got it to the point where in debug mode, I
    can verify that my destination cast member has all the same modelResource and
    model properties, all the same shaders and textures as the source, yet nothing
    displays in the 3d window. I also attempted to copy light settings and camera
    settings, and I have a fairly high confidence level that the values are what
    they should be (again, I can see them when debugging). The only oddity, which
    I think is fine, is that there are multiple copies of shaders resulting from
    cloneModelFromCastMember. A duplicate shader is created for each model piece
    that uses that shader. I'm hoping that I'm just missing something fundamental
    like a "set this camera as your primary camera" function, or "now that you've
    built a light, actually activate it" function. Here are all the important
    parts of the code:
    --In a movie script that calls on startMovie
    gSource = member("AJ_pedalTest")
    gScene = member("Scene")

    gSource .resetWorld()
    gScene.resetWorld()

    gScene.preload()
    gSource.preload()

    repeat with i = 1 to gSource.model.count
    modelName = gSource.model[i].name
    if gScene.model(modelName) = void then
    gScene.cloneModelFromCastMember(modelName, modelName, gSource)
    end if
    end repeat

    And then in a on beginSprite behavior:
    gPointer = sprite("ourObject")

    --Set up camera
    mainCam = gScene.newCamera("mainCamera")
    mainCam.transform = gSource.camera[2].transform

    --Set up light sources
    copiedLight = gScene.newLight("copiedLight",#point)
    copiedLight = gSource.light[2]

    It all compiles and runs, and all the fields of my source cast member and
    destination cast member match, but nothing displays in the sprite window on the
    stage. Any ideas?

    Thanks very much for your time!

    praesul Guest

  2. #2

    Default Re: cloneModelFromCastMember help

    I am not sure, but there seems to be a small error in your repeat loop.
    "modelName = gSource.model[i].name" should do the trick. Notice the [i] after
    model. You were not getting any modelnames it seems, or only one.

    Perhaps it helps.

    PpHammer Guest

  3. #3

    Default Re: cloneModelFromCastMember help

    You're creating a new camera in 'gScene', but you don't appear to be making the
    viewport sprite actually use that cam (so its probably still using the default
    camera).

    Perhaps you need this after you create 'mainCam':

    gPointer.camera = mainCam

    hope this helps!

    - Ben

    duckets Guest

  4. #4

    Default Re: cloneModelFromCastMember help

    For anyone who's interested, I ended up using loadFile()
    One word of caution- because of the time required to load things, you should
    load things in the "enterframe" handler, and before and after each loadFile
    call make sure you have a loop that runs until your shockwave 3d object state (
    member("myObject").state is 0 or 4 indicating that Director is ready to go and
    finished loading previous items.
    Here's my code as an example:

    ----------------------------------------------------------------------
    on enterframe me \
    ----------------------------------------------------------------------
    if pIsFirstEntry = 0 then
    pIsFirstEntry = 1
    pScene.loadFile( "AJ_bonesTest.w3d", false, true )

    repeat while ((pScene.state <> 4) and (pScene.state <> 0))
    updatestage
    end repeat

    pScene.loadFile( "floor.w3d", false, true )

    repeat while ((pScene.state <> 4) and (pScene.state <> 0))
    updatestage
    end repeat
    praesul Guest

Similar Threads

  1. using cloneModelFromCastMember
    By Roofy in forum Macromedia Director 3D
    Replies: 0
    Last Post: September 17th, 02:09 AM
  2. cloneModelFromCastMember
    By darylku in forum Macromedia Director 3D
    Replies: 7
    Last Post: April 18th, 04:33 PM
  3. using the CloneModelFromCastMember
    By Roofy in forum Macromedia Director 3D
    Replies: 2
    Last Post: September 23rd, 10:20 AM
  4. cloneModelFromCastmember and addChild
    By yogeshhungama in forum Macromedia Director 3D
    Replies: 1
    Last Post: July 22nd, 01:12 PM
  5. cloneModelFromCastMember playing up
    By LeeD in forum Macromedia Director 3D
    Replies: 3
    Last Post: August 7th, 10:08 PM

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