Interaction with a 3D Cube

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

  1. #1

    Default Interaction with a 3D Cube

    I?m developing a webpage where it has to be a 3D cube, and each of its faces
    has to point to a different URL. I have already constructed and shaded the
    cube. I have also coded the part of the rotation of the cube. But I still not
    find the part where the click on a certain face lead me to a specified URL.

    I wrote this code in order to find the way to know wich face has been clicked:




    ************************************************** ******************************
    ************************************************** *

    on mouseUp me
    returnData = member("3D").camera[1].modelsUnderLoc(the mouseLoc,#detailed)
    member("TXTcara").text = "You clicked on face " && returnData[1].faceID
    end


    ************************************************** ******************************
    *************************************************
    where TXTcara is a textfield on the stage where I print which face has been
    clicked



    But it always says me that I clicked on face 1 or face 2. I mean a cube has 6
    faces... and this code says that it has only two!!

    How can I cerainly know wich face has been clicked??

    The cube was constructed as a box.

    Bukue Guest

  2. Similar Questions and Discussions

    1. recognize face of cube
      hello! i'm just starting out in this 3D world. i've already managed to creat and understabd some models in 3d. What i have in mind is to creat a...
    2. Cube
      Hi, I have just installed V 8.0 on XP and I have discovered some interesting functions related to cubes and crosstabs. Navigating on the site...
    3. cube surfaces
      I would like to use images (jpeg) on each surface of a rotating cude.... Could anyone help me??? not sure where to start. i have coded a rotating...
    4. Damn Cube!
      So freehand has developed an aversion to cubes. I was making them using the "Deconstruction FreeHand grapics: Part 1" tutorial method, which no...
    5. create 3d cube
      Hello all! I'm really struggling with lingo! Would someone please tell me in simple terms/language how to create a 3d cube (preferably with...
  3. #2

    Default Re: Interaction with a 3D Cube

    the face is the polygon and not the face of the cube.
    if you use the built-in modelresource than each face of the cube has a
    seperate shader (look at the models shaderlist). I am pretty sure, you will
    assign different shaders to the different clickable cube faces. so you will
    need to get the shader which was clicked on.
    this information is the #meshID of the picking data which is returned by the
    picking functions (modelunderloc and modelunderray), if set to #detailed.

    so in your case:

    on mouseUp me
    returnData = member("3D").camera[1].modelsUnderLoc(the mouseLoc,#detailed)
    member("TXTcara").text = "You clicked on face " && returnData[1].meshID
    end



    I guess your snippet is a fast sample to point out the problem, but just in
    case...you should check, if a model was hit in the first place and often the
    above behavior is on the 3-D sprite and if you have only one camera you could
    get away with all the hardcode (member name, camera index etc.) with:

    on mouseUp me
    sp = sprite(me.spritenum)
    ml = the mouseLoc - point(sp.left, sp.top)
    cam = sp.camera
    returnData = cam.modelsUnderLoc(ml, #detailed)
    if count(returnData) > 0 then member("TXTcara").text = "You clicked on face
    " && returnData[1].meshID
    end


    a?ex Guest

  4. #3

    Default Re: Interaction with a 3D Cube

    Thank you very much!! It works perfect!! =D
    Bukue 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