i have created a 3D object in wpf 3d and used prospective camera the positions are changed by mouse move event.
below are the xaml code
d:DesignHeight="300" d:DesignWidth="600">
<Grid Name="objGrid" MouseDown="Grid_MouseDown" MouseUp="Grid_MouseUp" MouseMove="Grid_MouseMove" Focusable="True">
<Border Name="border" Background="White" MouseDown="border_MouseDown"
BorderBrush="White"
BorderThickness="2"
CornerRadius="0"
Padding="25" Margin="0,-21,0,10">
<Viewport3D Name="mainViewPort" ClipToBounds="True" Opacity="10">
<Viewport3D.Camera >
<PerspectiveCamera x:Name="camera"
FarPlaneDistance="100"
LookDirection="0, 0, -5"
UpDirection="0,1,0"
NearPlaneDistance="1"
Position="0, 0, 5"
FieldOfView="50" />
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight x:Name="directionLightOfMainViewPort" Color="White"/>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
i want to manually set the camera position in a button click event.
i.e, i want that faces of the object appear in button click event .
What I have tried:
i want to do it on cs file not in xaml...
i had tried following code..
TranslateTransform3D obj = new TranslateTransform3D();
Vector3D updirection = new Vector3D(0, 1, 0);
Point3D position = new Point3D(0, 0, 5);
camera.UpDirection = updirection;
camera.Position = position;
mainViewPort.Camera = this.camera;
please help me how to do as i am new to wpf