Using MoveCameraConditions with TargetPositionCamera?
#2
The reason that the MouseCameraController is not working is probably that it cannot find Viewport3D or any other element where it could subscribe to mouse events.

When using MouseCameraController it is recommended to explicitly set the EventsSourceElement property to an element that will be used as an event source. 

If you want to rotate and move the camera only when mouse is over 3D objects, then set EventsSourceElement to Viewport3D object. If you would also like to rotate and move the camera when mouse is on a area without 3D objects, then set EventsSourceElement to a parent Border or other parent element (that element need to have Background property set - can be also set to Transparent, but should not be null).

For example:


Code:
<Border Name="ViewportBorder" Background="Transparent">
    <Viewport3D Name="MainViewport">
<!-- ... -->
    </Viewport3D>
</Border>

<cameras:TargetPositionCamera Name="Camera1" 
                              Heading="30" Attitude="-20" Bank="0" 
                              Distance="200" TargetPosition="15 10 0" 
                              ShowCameraLight="Always"
                              TargetViewport3D="{Binding ElementName=MainViewport}"/>

<ab3d:MouseCameraController Name="MouseCameraController1"
                            RotateCameraConditions="LeftMouseButtonPressed"
                            MoveCameraConditions="LeftMouseButtonPressed, ControlKey"
                            EventsSourceElement="{Binding ElementName=ViewportBorder}"
                            TargetCamera="{Binding ElementName=Camera1}"/>
Andrej Benedik
  


Messages In This Thread
RE: Using MoveCameraConditions with TargetPositionCamera? - by abenedik - 07-05-2017, 10:36 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)