Professional Web Applications Themes

Camera rotation - Macromedia Director 3D

hi, how can i rotate camera like in 1st person 3d shooter? if i use behavior from chrome lib it rotates my whole 3d world for 90 degrees......

Sponsored Links
  1. #1

    Default Camera rotation

    hi,

    how can i rotate camera like in 1st person 3d shooter? if i use behavior from chrome lib it rotates my whole 3d world for 90 degrees...
    Sponsored Links
    de4med Guest

  2. #2

    Default camera rotation

    Hi there all, I am having this problem I can't resolve. What I am tring to do
    is tring to get the camera to rotate around the world's axis but using the
    speed of the mouse as the user leftclick drags the mouse around the 3d world
    just like how it works in the shockwave 3d window. However here is the
    problem... if I try this code... offset = (the mouseloc) - mouseStartLoc
    sprite(me.spriteNum).camera.rotate(offset.locv, offset.loch, 0, #world) the
    camera does rotate around the world's axis, but because 'rotate' is a command
    that increases the x,y,z axis and the camera starts to rotate but gets faster
    and faster and faster. ... but then if I wright this code... offset = (the
    mouseloc) - mouseStartLoc sprite(me.spriteNum).camera.transform.rotation =
    vector(offset.locv, offset.loch, 0) it then rotates the camera the right speed
    but it doesn't rotate camera around the world's axis. Meaning the camera
    rotates on it's on axis. So my question is, how can I resolve this with out
    using any xtra plug-ins, but have the same concept how it works in the
    shockwave 3d window?

    Roofy Guest

  3. #3

    Default Re: camera rotation

    I think the problem is in detecting the mouse rather than your use of
    rotate.

    You need to compare the mouseLoc to the mouseLoc of the previous frame NOT
    the startMouseLoc of the last click. Psuedo code snippet. . . check for
    errors/typos first. . .


    ------------------------
    property prevMouseH,prevMouseV

    on beginSprite-------------
    prevMouseH = the mouseH
    prevMouseV = the mouseV
    end beginSprite

    on exitFrame--------------
    if the mouseDown then
    cam.rotate(the mouseH-prevMouseH,the mouseV-prevMouseV,0,#world)
    end if
    prevMouseH = the mouseH
    prevMouseV = the mouseV
    end exitFrame
    ----------------------------


    This way the user can drag the model correctly.

    Hope that helps

    Richard Smith


    Richard Guest

  4. #4

    Default Re: camera rotation

    Originally posted by: Newsgroup User I think the problem is in detecting the
    mouse rather than your use of rotate. You need to compare the mouseLoc to the
    mouseLoc of the previous frame NOT the startMouseLoc of the last click. Psuedo
    code snippet. . . check for errors/typos first. . . ------------------------
    property prevMouseH,prevMouseV on beginSprite------------- prevMouseH = the
    mouseH prevMouseV = the mouseV end beginSprite on exitFrame-------------- if
    the mouseDown then cam.rotate(the mouseH-prevMouseH,the
    mouseV-prevMouseV,0,#world) end if prevMouseH = the mouseH prevMouseV = the
    mouseV end exitFrame ---------------------------- This way the user can drag
    the model correctly. Hope that helps Richard Smith thanks dude Yup, that
    did the trick. I have one more question that came upon when test your method. I
    wanted to know if it is possible to control the speed of how much the camera
    should rotate by how close you are to the center of an object axis? For example
    if lets say that the object center axis is 0, 0, 0 and the camera is at 100,
    100, 100 then make the mouse drag diffrence be divided by 2. Then lets say that
    camera is at 10, 100, 10 then the drag difference should be divided by 4 which
    now the camera would rotate at a slower rate becuase it is closer to the
    object. Is this possible? I would like to make it as a visual effect that makes
    that feeling that you are closer to an object. Yeah I know, the object itself
    will get larger which also gives the illusision that you are closer to an
    object but I also want rotation as well.

    Roofy Guest

  5. #5

    Default Re: camera rotation


    Ummmm OK. . . This might work. . . You may need to tinker with it though.
    It should scale the movement based on the proximity of the camera to the
    world origin (including the height of the camera). If you change the max
    distance (to spin at full speed) Make sure you change all three values in
    the behavior (currently set to 500.00). Keep them all floats (with the
    decimal place and zeros)

    ------------------------
    property prevMouseH,prevMouseV

    on beginSprite-------------
    prevMouseH = the mouseH
    prevMouseV = the mouseV
    end beginSprite

    on exitFrame--------------
    if the mouseDown then
    tempDist = (cam.worldPosition).magnitude
    if tempDist > 500.00 then --crop tempDist to max
    tempDist = 500.00-- this is max distance to consider
    end if
    tempFactor = tempDist / 500.00--calculate scaling factor
    tempY = (the mouseH-prevMouseH)*tempFactor*2--edit 2 to alter speed
    tempX = (the mouseV-prevMouseV)*tempFactor*2--edit 2 to alter speed
    cam.rotate(tempX,tempY,0,#world)
    end if
    prevMouseH = the mouseH
    prevMouseV = the mouseV
    end exitFrame
    ----------------------------

    Good luck

    Richard Smith


    Richard Guest

  6. #6

    Default Camera Rotation

    I know im going to feel stupid once i recieve an answer to this - I need to
    know the quickest way to rotate a camera around an object. The object being a
    building, and the camera will be my point of view.

    IPS-PAT Guest

  7. #7

    Default Re: Camera Rotation

    you can use: yourCamera.rotate(vector_rot, OtherModel)

    to see how it works i made a few minutes ago this small demo. click on a model
    and use w,a,s,d to rotate around it. if you click on another model you will
    rotate around the other one.

    the script is put into a field member, it is a behavior that can be used to
    drag it onto a empty shockwave3D member.
    [url]http://kisd.de/~lutz/crap/rotate[/url]

    regards!

    hondo3000 Guest

Similar Threads

  1. Rotation between two transform.rotation vectors.
    By SuperTank in forum Macromedia Director 3D
    Replies: 3
    Last Post: September 27th, 05:07 PM
  2. reset camera rotation?
    By tacbob in forum Macromedia Director 3D
    Replies: 1
    Last Post: March 9th, 02:44 PM
  3. Camera rotation conversion to SWF MC Arrow
    By delex_media in forum Macromedia Director 3D
    Replies: 1
    Last Post: September 15th, 10:08 PM
  4. Camera rotation around an object
    By aperion0 in forum Macromedia Director 3D
    Replies: 0
    Last Post: July 14th, 04:51 AM
  5. Please help with camera rotation
    By de4med in forum Macromedia Director 3D
    Replies: 5
    Last Post: October 31st, 08:57 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