3 Replies Latest reply on Sep 11, 2006 1:03 PM by VonCede

    Repositioning camera to wanted distance

    VonCede
      I have a smal problem what I can't solve myself so I need your smarter guys help.

      I have done a small movie where I have a character and camera. Camera is a child of character so it follows around when character is moved. Charater direction can be turned with mouse and camera stays behind the character. If mouses is moved up or down camera also move up or down and then points to character with pointAt(pCharacter)

      Because I only move camera on it's Y-axis with transale function and then turn it, camera slowly falls more and more behind of the character.

      Now the stupid question: How do I calculate a new camera position so ti stays in same distance to character? ( I know, I'm stupid.) Or am I doing it all wrong with camera.translate(0,yAxis), camera.pointAt(pCharacter) then transalte again towards character method? Is there a better way to make a camera move like on sphere around desired object?
        • 1. Re: Repositioning camera to wanted distance
          _lw Level 1
          if you only turn the camera on the y-axix it will stay where it is and will stay relative to it's parent.

          yourcamera.transform.rotation=yourvector
          or
          yourcamera.rotate(yourvector)

          what are you doing that makes your camera left behind the charakter? can you post the code that makes it rotate?

          cheers!
          • 2. Re: Repositioning camera to wanted distance
            VonCede Level 1
            quote:

            if you only turn the camera on the y-axix it will stay where it is and will stay relative to it's parent.

            I don't want to just turn camera. I want to turn camera so charater stays always in middle of the FOV.

            • 3. Re: Repositioning camera to wanted distance
              VonCede Level 1
              quote:

              Quote:
              if you only turn the camera on the y-axix it will stay where it is and will stay relative to it's parent.

              I don't want to just turn camera. I want to turn camera so charater stays always in middle of the FOV.


              /me bang's his head on the keyboard.

              You were right. Like I said, I'm a bit stupid. Or a slow on today.

              member(whichCastmember).node(whichNode).rotate(rotationVector {, relativeTo})
              will do a trick. I case anyone else ever wonders this same problem. (yeah right)

              /me hides back in dark corner in shame.