open and close the door

Ask a Question related to Macromedia Director 3D, Design and Development.

  1. #1

    Default Re: open and close the door


    hi Agustín !!

    Thx for the answer.

    I think i ll need a variable to detect if the motion reach the end of the
    portion open for then determine which portion of the animation have to
    play...
    My motion is 3333 ms long and there is my scrip to open the door :


    on mouseUp me
    thisSprite = sprite(me.spriteNum)
    -- Get the mouse location, adjusted to the sprite,
    -- in the old 2D manner.
    theLoc = the mouseLoc - point(sprite(thisSprite).left,
    sprite(thisSprite).top)
    -- Find the model under the mouse closest to the camera
    theModel = sprite(thisSprite).camera(1).modelUnderLoc(theLoc)
    if theModel = member("19_anim").model("bouton_arriere") then
    member(1).model("bouton_arriere").keyframeplayer.p layrate = 0.5
    -- play
    member(1).model("bouton_arriere").keyframeplayer.p lay("bouton_arriere-Motion
    0", 0, 0, 1250, 1)
    end if
    end


    frank Guest

  2. Similar Questions and Discussions

    1. open/close 2 doors at the same time
      Im having trouble (again).. this time - I need to open/close two doors at the same time with the activation being from a button (object) that is not...
    2. open a door with havok
      hello friends, at the moment i am working on a tool that uses the havok xtra. for the things i want to do, the most important thing is to use a...
    3. Click to open door
      I made a door and want to open it by clicking on it. But when I rotate it to open it turns around its own centerpoint. Does anyone knowhow I can...
    4. Close or end an open movie
      Hi I have three+ movies: movie1 movie2 movie3 Movie 1 has the option to play either Movie2 or Movie3. How can I close Movie2 when returning...
    5. how to close an open cursor
      I got careless and had an infinite loop. Killed my session. Now my cursor is still open. I dont have a handler too it. How do I close it without...
  3. #2

    Default Re: open and close the door

    frank wrote:
    > I think i ll need a variable to detect if the motion reach the end of the
    > portion open for then determine which portion of the animation have to
    > play...
    Yup. That´s true. You have a copuple of ways for accomplishing this.
    The easier is to set a variable TRUE or FALSE depending on the state od
    the door:

    property pDoorOpened

    on mouseUp me
    --mousePicking code

    if pDoorOpened = FALSE then

    --OPEN:
    member(1).model("bouton_arriere").keyframeplayer.p lay("bouton_arriere-Motion0",
    0, 0, 1250, 1)
    pDoorOpened = TRUE

    else

    --CLOSE:
    member(1).model("bouton_arriere").keyframeplayer.p lay("bouton_arriere-Motion0",
    0, 0, 1250, -1, 1250)
    pDoorOpened = FALSE

    end if

    But this doesn´t avoid the user clicking while the door is moving thus
    messing up the motion. You´d have to add some detection to see if the
    motion is playing or not.

    property pDoorOpened
    property pMember
    property pMotionPlaying

    on beginSprite me
    pMember = member(1)
    pMember.registerForEvent(#animationStarted, #forbidAnim, me)
    pMember.registerForEvent(#animationEnded, #allowAnim, me)
    end

    on forbidAnim me --llamado por evento #animationStarted
    pMotionPlaying = TRUE --se está reproduciendo un motion
    end

    on allowAnim me --llamado por evento #animationEnded
    pMotionPlaying = FALSE --no hay nada en la playList
    end

    on mouseUp me
    --mousePicking code

    if pMotionPlaying = FALSE then

    if pDoorOpened = FALSE then

    --OPEN:
    member(1).model("bouton_arriere").keyframeplayer.p lay("bouton_arriere-Motion0",
    0, 0, 1250, 1)
    pDoorOpened = TRUE

    else

    --CLOSE:
    member(1).model("bouton_arriere").keyframeplayer.p lay("bouton_arriere-Motion0",
    0, 0, 1250, -1, 1250)
    pDoorOpened = FALSE

    end if
    end if

    Take care... it´s all e-mail-Lingo. But it should give an idea of how
    to handle this.

    C´ya!
    --
    Agustín María Rodríguez | [email]agustin@OnWine.com.ar[/email] | [url]www.OnWine.com.ar[/url]

    Agustín María Rodríguez Guest

  4. #3

    Default Re: open and close the door

    oooOOh ! Augustin u my hero!!

    IT S WORKS!!

    U trully safe me man! thx!

    I m an advanced user of Maya and if i can help u for something i'm your man.

    ooh man i can believe it thx again.


    frank Guest

Posting Permissions

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