2 Replies Latest reply on May 3, 2010 10:37 AM by Necromanthus

    rotate camera inside a sphere (or room)

    CRB_Pat

      I found this source code to start from http://necromanthus.com/Games/ShockWave/tutorials/PanCamera.html (no target) - Unfortunately, I dont have enough knowledge with Lingo to understand what I need to change to make this work with my scene. I've been reading into this for weeks trying to force a simple understanding, with no luck - any help would be much appreciated!!! **specifically i need this type of function, all the camera functions that are included with Director, do not work...this also includes the chromlibs camera.**

       

      my W3D file is called "example2", its #13 (in my cast)

      the room or in this case sphere (with image attached) is called "Sphere01"

      and my camera is "Camera01"

       

      here is a copy of the script from the above link: (I dont need the "dummy")

       

      global w
      global demo
      global dmy
      global pCamera
      global way
      property pMouse

      on beginSprite me
        pCamera = w.camera(1)
        pMouse = the mouseLoc
        if demo = 1 then
          w.model("room").clone("dummy")
          dmy = w.model("dummy")
          dmy.visibility = #back
          dmy.scale(0.066)
          dmy.rotate(0,0,180)
          pCamera.transform.position = vector(-50,0,20)
          pCamera.pointAt(dmy,vector(0,0,1))
          way = 40.0
        end if
      end

      on mouseDown
        pMouse = the mouseLoc
      end

      on exitFrame me
        if the mouseDown then
          dMouse = (pMouse - the mouseLoc) / 100.0
          dx = dMouse.locV * 20
          dz = dMouse.locH * 20
          if demo = 1 then
            pCamera.rotate(vector(0,dx,dz),dmy)
            pCamera.pointAt(dmy,vector(0,0,1))
          else
            pCamera.transform.rotation = pCamera.transform.rotation + vector(dx,0,dz)
          end if
          pMouse = the mouseLoc
        end if
        if demo = 1 then
          if keypressed(123) then
            -- Cursor Left is down
            pCamera.rotate(vector(0,0,-1),dmy)
          end if
          if keypressed(124) then
            -- Cursor Right is down
            pCamera.rotate(vector(0,0,1),dmy)
          end if
          if keypressed(125) then
            -- Cursor Up is down (Zoom In)
            if way < 80.0 then
              way = way + 0.2
              pCamera.translate(0,0,0.2)
            end if
          end if
          if keypressed(126) then
            -- Cursor Down is down (Zoom Out)
            if way > 0.0 then
              way = way - 0.2
              pCamera.translate(0,0,-0.2)
            end if
          end if
        end if
        go to frame 2
      end

        • 1. Re: rotate camera inside a sphere (or room)
          tyree_2 Level 2

          try the drag to rotate behavior link or group everything in your 3d program. and you can rotate everything that way

          • 2. Re: rotate camera inside a sphere (or room)
            Necromanthus Level 2

            CRB_Pat wrote:

             

            I found this source code to start from http://necromanthus.com/Games/ShockWave/tutorials/PanCamera.html (no target) - Unfortunately, I dont have enough knowledge with Lingo to understand what I need to change to make this work with my scene. I've been reading into this for weeks trying to force a simple understanding, with no luck - any help would be much appreciated!!! **specifically i need this type of function, all the camera functions that are included with Director, do not work...this also includes the chromlibs camera.**

             

            my W3D file is called "example2", its #13 (in my cast)

            the room or in this case sphere (with image attached) is called "Sphere01"

            and my camera is "Camera01"

            Hi,

             

            Edit the "init" movie script and replace "room" with "example2"

             

            Edit the "frame2" script and replace:

             

            w.camera(1) with w.camera("Camera01")

            and

            "room" with "Sphere01"

             

            That's all.