当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Zoom with Helixtoolkit

问题描述:

I'm trying to use a Leap Motion to control an 3D object with Helix Toolkit, and I am almost succeeding, but I'm wondering how to do "zoom" in the code-behind.

N.B. I'm using Caliburn (MVVM pattern).

I want to zoom in when I do a clockwise CircleAction, and zoom out otherwise:

public void CircleAction(bool isClockWise)

{

if (!detectionActive)

{

return;

}

if (isClockWise)

{

// To do

}

else

{

//To do

}

}

And here is my HelixToolkit zone:

 <HelixToolkit:HelixViewport3D.Camera>

<PerspectiveCamera

Position="{Binding CameraPosition,Mode=TwoWay}"

LookDirection="{Binding CameraDirection,Mode=TwoWay}"

UpDirection="{Binding Camera.UpDirection}"

FieldOfView="{Binding Camera.FieldOfView}"

/>

</HelixToolkit:HelixViewport3D.Camera>

</HelixToolkit:HelixViewport3D>

网友答案:

From the SurfaceDemo example in the helix-toolkit source and the documentation for the CameraController class, I can suggest the following.

XAML:

<HelixToolkit:HelixViewport3D x:Name="myViewPort3D">
<!-- ... -->
</HelixToolkit:HelixViewport3D>

Code-behind:

public void CircleAction(bool isClockWise)
{
    if (!detectionActive)
    {
        return;
    }
    if (isClockWise)
    {
        myViewPort3D.CameraController.zoom(delta);
    }
    else
    {
        myViewPort3D.CameraController.zoom(-delta);
    }
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: