共用方式為


RayMeshGeometry3DHitTestResult.DistanceToRayOrigin 屬性

定義

取得啟始點擊測試之 Visual3D 的交集點與射線在座標空間中的原點之間的距離。

public:
 virtual property double DistanceToRayOrigin { double get(); };
public override double DistanceToRayOrigin { get; }
member this.DistanceToRayOrigin : double
Public Overrides ReadOnly Property DistanceToRayOrigin As Double

屬性值

雙精度浮點數值,指出啟始點擊測試之 Visual3D 的交集點與射線在座標空間中的原點之間的距離。

範例

下列程式碼摘錄會讀取此屬性。

public void UpdateResultInfo(RayMeshGeometry3DHitTestResult rayMeshResult)
{
    HitVisualInfo.Text = rayMeshResult.VisualHit.ToString();
    HitModelInfo.Text = rayMeshResult.ModelHit.ToString();
    HitMeshInfo.Text = rayMeshResult.MeshHit.ToString();
    //HitMaterialInfo.Text = (rayMeshResult.ModelHit as GeometryModel3D).Material.GetType().Name;
    //HitMaterialBrushInfo.Text = ((rayMeshResult.ModelHit as GeometryModel3D).Material as DiffuseMaterial).Brush.ToString();
    HitDistanceInfo.Text = rayMeshResult.DistanceToRayOrigin.ToString();
    Vertex1Info.Text = (rayMeshResult.VertexWeight1 * 100) + "%";
    Vertex2Info.Text = (rayMeshResult.VertexWeight2 * 100) + "%";
    Vertex3Info.Text = (rayMeshResult.VertexWeight3 * 100) + "%";
}
Public Sub UpdateResultInfo(ByVal rayMeshResult As RayMeshGeometry3DHitTestResult)
    HitVisualInfo.Text = rayMeshResult.VisualHit.ToString()
    HitModelInfo.Text = rayMeshResult.ModelHit.ToString()
    HitMeshInfo.Text = rayMeshResult.MeshHit.ToString()
    HitDistanceInfo.Text = rayMeshResult.DistanceToRayOrigin.ToString()
    Vertex1Info.Text = (rayMeshResult.VertexWeight1 * 100) & "%"
    Vertex2Info.Text = (rayMeshResult.VertexWeight2 * 100) & "%"
    Vertex3Info.Text = (rayMeshResult.VertexWeight3 * 100) & "%"
End Sub

適用於