A question about MathUtils

Topics: Developer Forum, User Forum
Feb 7, 2007 at 12:43 PM
Hello,

I am currently playing with cameras and tried the following code :

_perspectiveCamera = new PerspectiveCamera(
	new Point3D(0, 0, 0), new Vector3D(0, 0, -1), new Vector3D(0, 1, 0), 70);
_perspectiveCamera.NearPlaneDistance = 1;
_perspectiveCamera.FarPlaneDistance = 1000;
 
_matrixCamera = new MatrixCamera(
	MathUtils.GetViewMatrix(_perspectiveCamera),
	MathUtils.GetProjectionMatrix(_perspectiveCamera, 320 / 240));

Then, when switching from one camera to the other, I noticed that the view was changing.
I expected my two cameras to "look" exactly the same... Did I miss something ?

Thank you for your help.

Thomas
Coordinator
Feb 15, 2007 at 2:46 AM
What you have should work. I think the problem is with your GetProjectionMatrix call though. 320 / 240 (int / int) == 1. Cast one of them to a double and you should be ok. If that wasn't it, let me know.

-Kurt