• Advertisement
Sign in to follow this  

[MDX] Camera Troubles

This topic is 3890 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

I think my theory and what is actually happening is off, because I'm lost in 3D space. Using the coordinates of the triangle, if I positioned the camera at 0,0,-20, should it not be facing the triangle?
        private void CameraPositioning()
        {
            device.Transform.Projection = Matrix.PerspectiveFovLH(
                (float)Math.PI / 4,
                this.Width / this.Height,
                1f,
                50f);

            device.Transform.View = Matrix.LookAtLH(
                new Vector3(0, 0, 0),
                new Vector3(0, 0, 0),
                new Vector3(0, 1, 0));
        }

        private void VertexDeclaration()
        {
            vertices = new CustomVertex.PositionTextured[3];

            vertices[0].Position = new Vector3(10f, 10f, 0f);
            vertices[0].Tu = 0;
            vertices[0].Tv = 0;

            vertices[1].Position = new Vector3(-10f, -10f, 0f);
            vertices[1].Tu = 1;
            vertices[1].Tv = 1;

            vertices[2].Position = new Vector3(10f, -10f, 0f);
            vertices[2].Tu = 0;
            vertices[2].Tv = 1;
        }

Share this post


Link to post
Share on other sites
Advertisement
Maybe it's just an error in your post, but your Matrix.LootAtLH has the position at (0,0,0) not (0,0,-20)

Share this post


Link to post
Share on other sites
Whoops, I did have that at 0,0,-20. I must have changed it later trying to fix it.

Share this post


Link to post
Share on other sites
Nevermind, I realized I was calling two different methods to do the same thing, which was set up the camera. :S

Share this post


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

  • Advertisement