public class TargetPositionCamera : BaseTargetPositionCamera, IMovableCamera
Thetype exposes the following members.
Gets or sets a nullable Point3D that can specify a custom 3D position around which this TargetPositionCamera is rotated. Rotation around custom center position changes the camera angles (Heading and Attitude) and also TargetPosition. When RotationCenterPosition is null, the rotation is done with changing only Heading and Attitude properties.
Gets or sets a Point3D that defines the position on which the camera is looking.
Animates the TargetPosition, Distance and CameraWidth to the specified values. The animation takes animationDurationInMilliseconds and uses the specified easingFunction.
This method is called from CreateFrom method and actually sets the properties on this camera.(Overrides SphericalCameraBaseCreateFrom(Camera).)
Moves the camera backward (in the opposite as look direction)
Moves the camera for the moveVector (regardless of the current camera's LookDirection and UpDirection)
Moves the camera down (in the opposite up direction)
Moves the camera forward (in the look direction)
Moves the camera left (strafe)
Moves the camera right (strafe)
Animates the TargetPosition to the finalTargetPosition. The animation takes animationDurationInMilliseconds and uses the specified easingFunction.
Moves the camera up (in the up direction)
Rotates this camera for the specified heading and attitude. When RotationCenterPosition is set, the camera rotates around RotationCenterPosition which can change Heading, Attitude, TargetPosition and Distance.(Overrides SphericalCameraRotateCamera(Double, Double).)
Calculates the moveVector based on the current camera's LookDirection and UpDirection
TargetPositionCamera is a camera that is looking at the TargetPosition from the specified angle and distance.
TargetPositionCamera also has some other properties that are common to all cameras that derive from SphericalCamera class.
The ShowCameraLight and the CameraLight properties can be used to add a lights to the Viewport3D that is positioned at the same position as the camera and is looking at the cameras direction. In the real world this would be a light that is mounted to the camera. This way the 3D objects that are viewed with the camera are always illuminated regardless of the cameras position.
The ShowCameraLight defines when the camera light is shown. The possible values are:
The CameraLight property is by default a DirectionalLight with White color. The value can be set to a new DirectionalLight with some other color. Other types of Lights are not supported - will not change according to the camera's changed.
Because SphericalCamera is derived from BaseCamera, the TargetPositionCamera also contains properties that are defined in BaseCamera and therefore common to all the cameras:
If the Window, Page or UserControl has only one Viewport3D, there is no need to set and of the above properties on the camera. By default the IsAutoViewport3DFindingEnabled is set to true and that means, that the Viewport3D is automatically find from the current UserControl, Page or Window and it is set to a TargetViewport3D property.
But if there are more Viewport3D objects defined, than by default the first Viewport3D will be used by the camera. With setting the TargetViewport3D or TargetViewport3DName it is possible to specify which Viewport3D will be controlled by the camera.
The following xaml creates a Viewport3D with a 3D Box and a TargetPositionCamera that is looking at the bottom of the Box from above. The Distance from the camera to the TargetPosition is 100. Because there is no light defined in the Viewport3D and the default value of the camera's ShowCameraLight property is true, the cameras adds a light that is illuminating the scene.
<Page x:Class="PowerToysSamples" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:visuals="clr-namespace:Ab3d.Visuals;assembly=Ab3d.PowerToys" xmlns:ab3dControls="clr-namespace:Ab3d.Controls;assembly=Ab3d.PowerToys" xmlns:cameras="clr-namespace:Ab3d.Cameras;assembly=Ab3d.PowerToys"> <Grid> <Viewport3D> <visuals:BoxVisual3D CenterPosition="50 100 0" Size="50 200 20" Material="Blue"/> </Viewport3D> <cameras:TargetPositionCamera Heading="0" Attitude="-50" Distance="100" TargetPosition="75 0 20"/> <ab3dControls:MouseCameraController/> <ab3dControls:CameraControlPanel VerticalAlignment="Bottom" HorizontalAlignment="Left"/> </Grid> </Page>