Professional Web Applications Themes

cloneMotionFromCastmember problem (newbie'ish) - Macromedia Director 3D

Is there any easy way to avoid having to activate keyframe motions for each and every component of a model that's been placed in the scene using cloneModelFromCastmember? Right now I'm having to add two lines like this for every moving part of my engine model: myScene.cloneMotionFromCastmember("v6_crank.1-key", "v6_crank.1", member("v6")) myscene.model("v6_crank.1").keyframePlayer.play("v 6_crank.1-key", true, 1, 1000, 1) -- followed by two more lines for the component of the model: myScene.cloneMotionFromCastmember("v6_crank.2-key", "v6_crank.2", member("v6")) myscene.model("v6_crank.2").keyframePlayer.play("v 6_crank.2-key", true, 1, 1000, 1) This works fine, but it's going to get pretty tedious depending on how many components I need moving. Is there a repeat with statement ...

  1. #1

    Default cloneMotionFromCastmember problem (newbie'ish)

    Is there any easy way to avoid having to activate keyframe motions for each
    and every component of a model that's been placed in the scene using
    cloneModelFromCastmember? Right now I'm having to add two lines like this
    for every moving part of my engine model:

    myScene.cloneMotionFromCastmember("v6_crank.1-key", "v6_crank.1",
    member("v6"))
    myscene.model("v6_crank.1").keyframePlayer.play("v 6_crank.1-key", true, 1,
    1000, 1)
    -- followed by two more lines for the component of the model:
    myScene.cloneMotionFromCastmember("v6_crank.2-key", "v6_crank.2",
    member("v6"))
    myscene.model("v6_crank.2").keyframePlayer.play("v 6_crank.2-key", true, 1,
    1000, 1)

    This works fine, but it's going to get pretty tedious depending on how many
    components I need moving. Is there a repeat with statement that I could use
    to do this sort of thing in one big sweep so that I can avoid hard-coding
    this?

    Any help would be appreciated.


    drew Guest

  2. #2

    Default Re: cloneMotionFromCastmember problem (newbie'ish)

    drew wrote:
    > Is there any easy way to avoid having to activate keyframe motions for each
    > and every component of a model that's been placed in the scene using
    > cloneModelFromCastmember? Right now I'm having to add two lines like this
    > for every moving part of my engine model:
    >
    > myScene.cloneMotionFromCastmember("v6_crank.1-key", "v6_crank.1",
    > member("v6"))
    > myscene.model("v6_crank.1").keyframePlayer.play("v 6_crank.1-key", true, 1,
    > 1000, 1)
    > -- followed by two more lines for the component of the model:
    > myScene.cloneMotionFromCastmember("v6_crank.2-key", "v6_crank.2",
    > member("v6"))
    > myscene.model("v6_crank.2").keyframePlayer.play("v 6_crank.2-key", true, 1,
    > 1000, 1)
    >
    > This works fine, but it's going to get pretty tedious depending on how many
    > components I need moving. Is there a repeat with statement that I could use
    > to do this sort of thing in one big sweep so that I can avoid hard-coding
    > this?
    >
    > Any help would be appreciated.
    >
    >
    You´re looking for a repeat loop. This might be one of the possible
    approaches:


    repeat with i = 1 to v6Scene.model.count
    thisModel = v6Scene.model[i]
    if thisModel.name contains "-key" then
    shortName = me._removeKey(thisModel.name)
    myScene.cloneMotionFromCastmember(thisModel.name, shortName,
    v6Scene)
    myScene.model(shortName).keyframePlayer.play(thisM odel.name, true, 1,
    1000, 1)
    end if
    end repeat

    That loop will find all the motions of the scene v6, clone them to
    myScene and then play them. The code might not work as it is cuz it´s
    e-mail-hangover-Lingo and besides, you´d have to do some text Lingo for
    the _removeKey function that returns the name of the model without "-key".

    Good luck,
    --
    Agustín María Rodríguez | [email]agustinOnWine.com.ar[/email] | [url]www.OnWine.com.ar[/url]

    Agustín María Rodríguez Guest

  3. #3

    Default Re:cloneMotionFromCastmember problem (newbie'ish)

    Another way is to apply a bone to each object in your 3D package, and all the animation can be combined into one bonesPlayer motion.

    Rix


    Rix webforumsuser@macromedia.com Guest

  4. #4

    Default Re: Re:cloneMotionFromCastmember problem (newbie'ish)


    Do you mean to parent a bone to each object? Then you can control the
    animation turning on/off the bonesPlayer motion on the root bone or what?

    Eith


    "Rix" <webforumsusermacromedia.com> ha scritto nel messaggio
    news:bo42jh$hhe$1forums.macromedia.com...
    > Another way is to apply a bone to each object in your 3D package, and all
    the animation can be combined into one bonesPlayer motion.
    >
    > Rix
    >
    >

    .::[E|th]::. Guest

  5. #5

    Default Re: Re:cloneMotionFromCastmember problem (newbie'ish)

    If you export each engine part as a mesh associated with a different bone (with any hierachy structure reqired by the pistons etc.) you can export as all part of one object within a single w3D with just one single motion.

    Then you can animate the whole engine with a single call to the objects bonesPlayer modifier. Play stop rewind etc. You can even manipulate individual bones if required. It's just cleaner than having hundreds of objects each with a seperate motion.

    Rix


    Rix webforumsuser@macromedia.com Guest

  6. #6

    Default Re: cloneMotionFromCastmember problem (newbie'ish)

    Hi. Thanks for your help.

    Here's what I've come up with. I didn't need to delete the "-key" part since
    this was what I was trying tp append to the new motion names. I'm using
    "-new" now, but that's beside the point.

    on startmovie
    myScene = member("emptyworld")
    myScene.resetWorld()

    myScene.cloneModelFromCastMember("#v6_clone","#v6" ,member("v6"))
    myScene.model("#v6_clone").addToWorld()

    repeat with i = 1 to member(myScene).model.count
    theModel = member(myScene).model[i]
    theKey = theModel.name
    newKeyName = thekey & "-new"
    myScene.cloneMotionFromCastmember(newKeyName, theModel,
    member("v6"))
    myScene.model(theModel).keyframePlayer.play(newKey Name, true, 1,
    1000, 1)
    end repeat
    end

    I'm getting an out of value range error right now. Any ideas why?
    > You´re looking for a repeat loop. This might be one of the possible
    > approaches:
    >
    >
    > repeat with i = 1 to v6Scene.model.count
    > thisModel = v6Scene.model[i]
    > if thisModel.name contains "-key" then
    > shortName = me._removeKey(thisModel.name)
    > myScene.cloneMotionFromCastmember(thisModel.name, shortName,
    > v6Scene)
    > myScene.model(shortName).keyframePlayer.play(thisM odel.name, true, 1,
    > 1000, 1)
    > end if
    > end repeat
    >
    > That loop will find all the motions of the scene v6, clone them to
    > myScene and then play them. The code might not work as it is cuz it´s
    > e-mail-hangover-Lingo and besides, you´d have to do some text Lingo for
    > the _removeKey function that returns the name of the model without "-key".
    >
    > Good luck,
    > --
    > Agustín María Rodríguez | [email]agustinOnWine.com.ar[/email] | [url]www.OnWine.com.ar[/url]
    >

    drew Guest

  7. #7

    Default Re: Re:cloneMotionFromCastmember problem (newbie'ish)

    Thanks, I'll look into this.

    "Rix" <webforumsusermacromedia.com> wrote in message
    news:bo66cd$96j$1forums.macromedia.com...
    > If you export each engine part as a mesh associated with a different bone
    (with any hierachy structure reqired by the pistons etc.) you can export as
    all part of one object within a single w3D with just one single motion.
    >
    > Then you can animate the whole engine with a single call to the objects
    bonesPlayer modifier. Play stop rewind etc. You can even manipulate
    individual bones if required. It's just cleaner than having hundreds of
    objects each with a seperate motion.
    >
    > Rix
    >
    >

    drew Guest

Similar Threads

  1. cloneMotionFromCastmember with Bipeds
    By .marco in forum Macromedia Director 3D
    Replies: 4
    Last Post: January 19th, 05:00 PM
  2. clonemotionfromcastmember error
    By Zack S in forum Macromedia Director 3D
    Replies: 0
    Last Post: November 14th, 08:55 AM
  3. newbie problem
    By Karzy in forum ASP.NET Building Controls
    Replies: 5
    Last Post: June 26th, 04:31 AM
  4. newbie has a problem...please help me out
    By Timon in forum FileMaker
    Replies: 1
    Last Post: September 17th, 11:55 AM
  5. Please help with newbie problem
    By Mark F. in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: August 15th, 10:14 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