How to look at the front of 3D
Model in WPF
?
I am confused to set X Y Z for LookDirection.
I don\'t know what happens when I set xy
Imagine, instead of a camera, you're moving your head around in 3D space. then Camera.Position
is specifying where your head is located, Camera.LookDirection
determines the direction you're looking at and Camera.UpDirection
shows the orientation of your head. the following pictures clear things up for you.
In the first Image, Camera is centered on the +Z axis looking down to -Z axis and to your shape:
When you set camera.Position
to for example (x=1, y=0, z=10) then camera position changes like this:
as a result, camera moves a little to the right and therefore you will see your shape at the left side of the view.
Now if camera.LookDirection
gets changed to say (x=0, y=1, z=-1), then camera simply looks at the point (0,1,-1) like this:
Important Edit:
Based on DaveInCaz's comment, LookDirection
is different from LookAtPoint
(former property of PrespectiveCamera
which was a Point3D
rather than
Vector3D
).
LookDirection
is actually equals to "the point to look at" minus "camera position".
This means that in the above diagram, if we want the camera which is located in (1,0,10) to look at point (0,1,-1) then the LookDirection
should be:
(0,1,-1) - (1,0,10) = (-1,1,-11).
And finally, camera.UpDirection
determines where the top of your camera points at. In the following picture, setting camera.UpDirection
to (-0.5,1,0) results in rotation of the camera counter clockwise:
I hope these pictures clear things up for you.