Jump to content
  • Advertisement
Sign in to follow this  
WaveMax

LookAtLH not working with OrthoLH

This topic is 4697 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Ortho projection doesn't depend on the z coordinate. You must scale the objects to get the zoom effect when using an ortho projection.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!