Professional Web Applications Themes

Recognising what 3D model the mouse pointer is under - Macromedia Director 3D

HI All, I have got the code below so far, but i need to be able to recognise which wall model the mouse is under so it applies the material to only that wall. This is my code at the moment: -- PROPERTY DECLARATIONS -- property pSprite -- this sprite property pStartLoc -- the initial position of this sprite property pMember -- the member of this sprite property pColor -- the name of pMember converted to a color property pOffset -- the offset between the mouse and the sprite loc -- when the user starts dragging -- EVENT HANDLERS -- ...

  1. #1

    Default Recognising what 3D model the mouse pointer is under

    HI All,

    I have got the code below so far, but i need to be able to recognise which
    wall model the mouse is under so it applies the material to only that wall.

    This is my code at the moment:


    -- PROPERTY DECLARATIONS --

    property pSprite -- this sprite
    property pStartLoc -- the initial position of this sprite
    property pMember -- the member of this sprite
    property pColor -- the name of pMember converted to a color

    property pOffset -- the offset between the mouse and the sprite loc
    -- when the user starts dragging

    -- EVENT HANDLERS --

    on beginSprite(me) ---------------------------------------------------
    -- ACTION: Initializes properties
    --------------------------------------------------------------------

    pSprite = sprite(me.spriteNum)
    pStartLoc = pSprite.loc

    --pMember = pSprite.member
    --pColor = rgb(pMember.name) -- "#FF9900" => rgb( 255, 153, 0 )
    --end beginSprite

    on endSprite(me) -----------------------------------------------------
    -- ACTION: Ensures that this instance is deleted from the actorList
    --------------------------------------------------------------------

    --(the actorList).deleteOne(me)
    end endSprite

    on mouseDown(me) -----------------------------------------------------
    -- ACTION: Starts dragging the sprite, and let the Drag Color Shader
    -- behavior start dragging an overlay with the image of this
    -- sprite
    --------------------------------------------------------------------

    pOffset = pStartLoc - the mouseLoc
    --sendAllSprites(#DragShaderColor, pMember, pColor, pOffset)

    (the actorList).append(me)
    end mouseDown

    on stepFrame(me) -----------------------------------------------------
    -- ACTION: Moves the sprite with the mouse, or returns it to its
    -- initial position when the mouse is released
    --------------------------------------------------------------------

    if the mouseDown then
    -- Drag the sprite with the mouse
    vLoc = the mouseLoc + pOffset

    else
    -- Return the sprite to its original position
    vLoc = pStartLoc
    (the actorList).deleteOne(me)
    end if

    pSprite.loc = vLoc
    end stepFrame

    --mouse up script
    on mouseUp me
    --deletes texture so new one can be applied to avoid duplicating names
    member("3DHouse").deleteTexture("ColourTexture")
    --defines the object the code applies to
    obj = member("3DHouse")
    --create model resource
    mr1 = obj.ModelResource("Wall01")
    --create the floor shader and texture
    ColourShd = obj.Shader("Inside Wall")
    ColourTxtr = obj.newTexture("ColourTexture", #fromCastMember, member("red1"))

    --assign texture to the shader
    ColourShd.texture = ColourTxtr
    ColourShd.textureList[1] = ColourTxtr

    --on prepareMovie
    member("3DHouse").shader("Outside Wall").textureList[1] =
    member("3DHouse").texture("ColourTexture")
    member("3DHouse").shader("Inside Wall").textureList[1] =
    member("3DHouse").texture("ColourTexture")
    --end

    --model and assign the resource
    md1 = obj.model("Wall01")
    md1.resource = obj.modelResource("Wall01")
    --assign the shader and texture to the model
    md1.shader = ColourShd
    end

    HELP!!!! would be greatly appreciated

    naddasmiles Guest

  2. #2

    Default Re: Recognising what 3D model the mouse pointer is under

    This lesson of our tutorials serie about Director3D game creation talks about
    your doubt:
    [url]http://www.dmu.com/3dd/dd4.html[/url]
    Better to read all the lessons of the serie. It's free!
    [url]http://www.dmu.com/3dd[/url]

    Americo Guest

  3. #3

    Default Re: Recognising what 3D model the mouse pointer is under

    Thanks those sites really helped.

    Nat
    naddasmiles Guest

Similar Threads

  1. changing pointer on mouse over
    By leontine06 in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 2
    Last Post: January 30th, 06:10 PM
  2. constrain mouse pointer
    By paul wright in forum Macromedia Flash
    Replies: 0
    Last Post: April 11th, 12:55 PM
  3. Mouse pointer flickers between hand and pointer
    By enutty webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 15
    Last Post: December 5th, 05:07 PM
  4. Sound & mouse/pointer ?
    By WWX webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 3
    Last Post: November 25th, 06:09 PM
  5. Recognising key presses + turning off mouse cursor?
    By Editz webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 6
    Last Post: November 19th, 08:32 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