In WPF 3D, why can't a perspective camera's LookDirection be straight down?
- by DanM
I'm attempting to position my perspective camera 30 units above the origin and pointing straight down.
If I set the LookDirection of the camera to "0,0,-1", however, everything disappears. I have to make it "0.01,0.01,-1" for it to work. Why?
<Window
x:Class="ThreeDeeTester.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1"
Height="300"
Width="300">
<Grid>
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera
Position="0,0,30"
LookDirection="0.01,0.01,-1"
UpDirection="0,0,1" />
<!-- LookDirection="0,0,-1" doesn't work...why? -->
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup>
<DirectionalLight
Color="White"
Direction="1,-1,-1" />
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="0,0,10 -5,-5,0 -5,5,0 5,5,0 5,-5,0"
TriangleIndices="2 1 0 2 0 3 4 3 0 1 4 0" />
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="Red" />
</GeometryModel3D.Material>
</GeometryModel3D>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
</Grid>
</Window>