LookAtLH not working with OrthoLH

Started by
1 comment, last by WaveMax 18 years, 7 months ago
Hi to all, I've a problem with the view and projection matrix. I've set the view matrix so I can zoom (change the camera Z posizion) using the mouse wheel. It works if I set the projection matrix using PerspectiveFovLH, but it stop working if I use OrthoLH.

	device.Transform.World = Matrix.Identity;
	Vector3 cameraPosition = new Vector3(0.0f, 0.0f, mousePos.Z);
	Vector3 cameraTarget = new Vector3(0.0f, 0.0f, 0.0f);

	device.Transform.View = Matrix.LookAtLH(cameraPosition, cameraTarget, new Vector3( 0.0f, 1.0f, 0.0f ) );

	// Doesn't work
        device.Transform.Projection = Matrix.OrthoLH(Width, Height,  1.0f, 100.0f);
			
        // Works
	float ratio = ( (float)Width / (float) Height);
	device.Transform.Projection = Matrix.PerspectiveFovLH( (float)(Math.PI / 4), ratio, 1.0f, 100.0f );


But I want it to be orthogonally.
Advertisement
Ortho projection doesn't depend on the z coordinate. You must scale the objects to get the zoom effect when using an ortho projection.
Thank you very much.
It works.

This topic is closed to new replies.

Advertisement