Re: Problems with camera rotation
From: VidalSasoon (vidalsasoon_at_bootbox.net)
Date: 07/26/04
- Next message: Phil Taylor: "Re: Multiple Devices"
- Previous message: Thomas: "Problems with camera rotation"
- In reply to: Thomas: "Problems with camera rotation"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Phil Taylor: "Re: Multiple Devices"
- Previous message: Thomas: "Problems with camera rotation"
- In reply to: Thomas: "Problems with camera rotation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|