Re: Problems with camera rotation

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: VidalSasoon (vidalsasoon_at_bootbox.net)
Date: 07/26/04


Date: 25 Jul 2004 23:04:37 -0700

It's a little late here so I don't really feel like thinking too
much... Just wanted to tell you to use radians instead of degrees.
Might be the source of some problems.

V.

"Thomas" <tfeldkam@sagor.prima.de> wrote in message news:<2miq70Fne1m3U1@uni-berlin.de>...
> Hello,
> I'm new to d3d and I have two problems. The first problem is in placing the
> camera. I think, I 'd calculated the targetviewpoint and the upvector right,
> but I'm not sure.
> I read the parameters for the camera from a file. This file defines the
> cameraobject not in directX-standard.
> In the file I've the front and back clipping areas, the field of view, the
> position and the rotation of the camera. The rotation is given as a
> quaternion.
> To calculate the targetpoint and the upvector of the camera I calculate as
> follows:
>
> m_targetViewPoint=m_position;
>
> m_targetViewPoint.Add(new Vector3(0,0,-ViewPoint.ZNearPlane));
>
> Matrix rotationMatrix=Matrix.Identity;
>
> rotationMatrix.RotateQuaternion(m_quaternion);
>
>
> m_targetViewPoint.TransformCoordinate(rotationMatrix);
>
> m_viewUpVector=new Vector3(0,1,0);
>
> m_viewUpVector.TransformCoordinate(rotationMatrix);
>
> Now I've the following problem. I want to rotate the camera on the x-axis
> and the y-axis.
> The camera should stand still on the fixed position. I first thought to
> rotate the targetviewpoint in the same way, as in code above.
> So I rotated the targetviewpoint with the
> quaternion(0,degree/360,degree/360,0). I use for this the following method:
> public void ModifyRotation(Quaternion rotation)
>
> {
>
> Matrix rotationMatrix=Matrix.Identity;
>
> rotationMatrix.RotateQuaternion(rotation);
>
> m_targetViewPoint.TransformCoordinate(rotationMatrix);
>
> }
>
> There were three problems. The first problem, If I call this method more
> than once the rotation stops at around 45 degree. The second problem is, the
> rotation only in one direction. The third poblem is, I think it is not a
> rotation on the x-axis. I think it is on the x and y-axis. But I'm not sure.
> Perhaps anyone can help me?
>
> cu Thomas



Relevant Pages

  • Re: Nikon maintains DSLR lead over Canon
    ... The sensor "moving" systems always have the sensor perpendicular to ... camera moves in translation in the x and y directions. ... What Pentax have added is a rotation around the lens axis (not tilts ...
    (rec.photo.digital.slr-systems)
  • Re: rotation
    ... create a vector representing the camera, ... then with that angle create a rotation matrix, set it on the device, draw. ... The angle that is a radian conversion says the value is ... I am trying to rotate this object so that it faces the camera for then ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: globe trotting?
    ... // First we do the look up and down rotation on the x axis. ... consider storing only a camera origin ... > where R is "big enough" to put the camera outside the sphere. ...
    (comp.graphics.algorithms)
  • Re: Fixed object using quaternion
    ... When i rotate or move the camera the objects have to ... are the specified vectors, is a rotation matrix. ... then the new model-to-world transformation ...
    (comp.graphics.api.opengl)
  • Problems with camera rotation
    ... I think, I 'd calculated the targetviewpoint and the upvector right, ... I read the parameters for the camera from a file. ... position and the rotation of the camera. ... The first problem, If I call this method more ...
    (microsoft.public.win32.programmer.directx.managed)