0

How to pause/resume a rotation?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

BogusException wrote at 2014-07-30 21:25:

Experts,

I had awful luck with rotating my object and it keeping it's lat/lon straight, so I did the below-which I think is rotating my camera around the single object I have...

I want to let me users stop & start the rotation (menu, keypress, all in code-behind), but all I can do now is either in XAML... I might be doing this wrong, and as a result the right way is eluding me..

Thoughts?

<Grid.Triggers>
        <EventTrigger RoutedEvent="Canvas.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation x:Name="camRotate360"  
                                     AutoReverse="False" 
                                     Duration="0:1:00" 
                                     From="360" 
                                     RepeatBehavior="Forever" 
                                     Storyboard.TargetName="camRotation" 
                                     Storyboard.TargetProperty="Angle" 
                                     To="0" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Grid.Triggers>
[...]
 <t:HelixViewport3D x:Name="view1" 
                       CameraRotationMode="Turnball"
                       ClipToBounds="False"
                       Grid.Column="0" 
                       IsChangeFieldOfViewEnabled="True"
                       IsHeadLightEnabled="True" 
                       IsHitTestVisible="True"
                       IsInertiaEnabled="True"
                       IsManipulationEnabled="True"
                       IsMoveEnabled="True"
                       IsPanEnabled="False"
                       IsRotationEnabled="True"
                       IsTouchZoomEnabled="True"
                       IsZoomEnabled="True"
                       LeftRightRotationSensitivity="5"
                       MouseDown="OnMouseDown" 
                       MouseMove="OnMouseMove" 
                       RotationSensitivity="5"
                       ShowCameraInfo="False"
                       ShowCameraTarget="False"
                       ShowCoordinateSystem="False"
                       ShowFieldOfView="False"
                       ShowFrameRate="True"
                       ShowTriangleCountInfo="True"
                       ShowViewCube="False"
                       SubTitle=""
                       SubTitleSize="0"
                       Title=""
                       TitleSize="0"
                       ZoomExtentsWhenLoaded="True" 
                       ZoomSensitivity="2"
                       ZoomAroundMouseDownPoint="True">
        <t:HelixViewport3D.Camera>
            <PerspectiveCamera Position="600,27400,0" 
                               LookDirection="0,1,0" 
                               UpDirection="0,0,1" 
                               NearPlaneDistance="0.01" 
                               FarPlaneDistance="Infinity" 
                               FieldOfView="40">

                <!-- I have to comment out the below to make the shape not rotate -->
                <!--<PerspectiveCamera.Transform>
                    <Transform3DGroup>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,0,1" Angle="0" x:Name="camRotation" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </Transform3DGroup>
                </PerspectiveCamera.Transform>-->

            </PerspectiveCamera>
        </t:HelixViewport3D.Camera>