Professional Web Applications Themes

RE-rotate - Macromedia Director 3D

Hi, all I have a scene include only one cast member called "cube" and this cast member include model called "red", all my need to do is "when I click button ... if model "red" in position (50,0,0) rotate it 180 degree around (0,0,0) world point. when I click again same button do that.. if model "red" in position (-50,0,0) rotate it 90 degree around (0,0,0) world point. I tried next code, but not give me right result.. on mouseup me if member("cube").model("red").transform.position = vector(50,0,0) then member("cube").model("red").rotate(0,0,180,#world) end if if member("cube").model("red").transform.position = vector(-50,0,0) then member("cube").model("red").rotate(0,0,90,#world) end if end I need ...

  1. #1

    Default RE-rotate

    Hi, all
    I have a scene include only one cast member called "cube" and this cast member
    include model called "red", all my need to do is "when I click button ...

    if model "red" in position (50,0,0) rotate it 180 degree around (0,0,0) world
    point.

    when I click again same button do that..

    if model "red" in position (-50,0,0) rotate it 90 degree around (0,0,0) world
    point.

    I tried next code, but not give me right result..

    on mouseup me
    if member("cube").model("red").transform.position = vector(50,0,0) then
    member("cube").model("red").rotate(0,0,180,#world)
    end if
    if member("cube").model("red").transform.position = vector(-50,0,0) then
    member("cube").model("red").rotate(0,0,90,#world)
    end if
    end

    I need know where my wrong in my code!!

    newmfa


    newmfa Guest

  2. #2

    Default Re: RE-rotate

    Check it out: [url]http://robotduck.com/misc/rgb[/url]

    Is this what you're after?

    (this movie is adapted from one that the original poster posted to the doug
    forums)

    This is what I've done:

    * Reduced your sprites down to one frame, and put a 'loop' behaviour on that
    frame.

    * Used a general-purpose 'sendallsprites' behaviour on the 3 buttons, so each
    button sends a call for the handler "changeColor", each with its own colour
    name as the argument sent to that handler.

    * Put a behaviour on the 3d scene (called 'world bhv'), which creates a group
    and sets it as the cube's parents. This way, you can rotate the group and the
    cubes rotate with it. This is called 'rotate pivot'.

    * The 'changeColor' handler (in the world behaviour) sets a value called
    "rotateDestination" based on what color name is received as the argument. This
    is the angle to which the rotate pivot must turn to.

    * Each frame, it checks whether the current angle of the rotate pivot ('r')
    needs to be adjusted, to move towards the rotateDestination value. If so, it
    increases or decreases the 'r' value by a small amount until it reaches the
    rotateDestination value.

    Hope this is all clear! (source code is linked at the page above)

    - Ben



    duckets Guest

  3. #3

    Default Re: RE-rotate

    tip:
    what if if member("cube").model("red").transform.position = vector(50.0001,0,0)?
    ensamblador Guest

Similar Threads

  1. 3d rotate
    By Don Seckler in forum Macromedia Director 3D
    Replies: 7
    Last Post: November 4th, 02:40 AM
  2. rotate table?
    By Lasse Edsvik in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: September 22nd, 02:12 PM
  3. Rotate Tool Won't Rotate
    By ThomZ webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 7
    Last Post: May 7th, 04:05 PM
  4. CCW Rotate and 180 rotate in PS CS are not working properly
    By Janet_Gerhardt@adobeforums.com in forum Adobe Photoshop Mac CS, CS2 & CS3
    Replies: 3
    Last Post: April 22nd, 03:24 PM
  5. Help on Rotate in 3D
    By Madgic webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 1
    Last Post: August 6th, 11:47 AM

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