2
我們使用3DTools(http://3dtools.codeplex.com)繪製一條3d線,它允許用戶通過鼠標旋轉它。我有問題,如何限制用戶只能在Z軸上旋轉它?或僅在X軸上,僅在Y軸上?如何僅在Z軸上旋轉3D對象?
<tool:TrackballDecorator >
<tool:Interactive3DDecorator
ContainsInk="True">
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera x:Name="camera1" Position="4.89,-11,5" LookDirection="-4.89,11,-5"
FieldOfView="45" UpDirection="-4,9,-1"/>
</Viewport3D.Camera>
<ModelVisual3D x:Name="modelVisual3D">
<ModelVisual3D.Children>
<tool:ScreenSpaceLines3D x:Name="axisX" Color="Cyan"
Thickness="2.0"
Points="0, 0, 0, 5, 0, 0" />
<tool:ScreenSpaceLines3D Color="LightCyan"
Thickness="2.0"
Points="-5, 0, 0, 0, 0, 0" />
<tool:ScreenSpaceLines3D x:Name="axisY" Color="Green"
Thickness="2.0"
Points="0,0,0, 0,5,0"/>
<tool:ScreenSpaceLines3D Color="LightGreen"
Thickness="2.0"
Points="0,-5,0, 0,0,0"/>
<tool:ScreenSpaceLines3D x:Name="axisZ" Color="Red"
Thickness="2.0"
Points="0,0,0, 0,0,5"/>
<tool:ScreenSpaceLines3D Color="LightPink"
Thickness="2.0"
Points="0,0,-5, 0,0,0"/>
</ModelVisual3D.Children>
</ModelVisual3D>
</Viewport3D>
</tool:Interactive3DDecorator>
</tool:TrackballDecorator>
你確定它旋轉線?我認爲它只是使用TrackballDecorator旋轉相機... – 2009-11-16 07:47:30
@SMART_n,您是對的,感謝您的提示,在閱讀3DTools源代碼後我知道它,並且我找到了一種限制Z軸旋轉的方法,它可以工作,但不好。 – 2009-11-16 14:55:42
什麼意思是「不好」? – 2009-11-16 15:29:17