Click or drag to resize
AB4D logo

BaseCameraCreateMouseRay3D Method (Point, Size, Matrix3D, Matrix3D, Point3D, Vector3D)

Note: This API is now obsolete.

CreateMouseRay3D calculates a normalized 3D ray that goes from the mouse position into the 3D scene. The ray goes from rayOrigin in the rayDirection. If the ray cannot be calculated this method returns false.

Namespace:  Ab3d.Cameras
Assembly:  Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 10.1.8147.1045
Syntax
C#
[ObsoleteAttribute("This method correctly calculates ray only for perspective camera (not for orthographic camera). Please use non-static CreateMouseRay3D or static CreatePerspectiveMouseRay3D or CreateOrthographicMouseRay3D.")]
public static bool CreateMouseRay3D(
	Point mousePosition,
	Size viewportSize,
	ref Matrix3D viewMatrix,
	ref Matrix3D projectionMatrix,
	out Point3D rayOrigin,
	out Vector3D rayDirection
)

Parameters

mousePosition
Type: System.WindowsPoint
mouse position
viewportSize
Type: System.WindowsSize
viewport size - usually size of Viewport3D (AvailableWidth, AvailableHeight)
viewMatrix
Type: System.Windows.Media.Media3DMatrix3D
camera's view matrix
projectionMatrix
Type: System.Windows.Media.Media3DMatrix3D
camera's projection matrix
rayOrigin
Type: System.Windows.Media.Media3DPoint3D
out - ray origin
rayDirection
Type: System.Windows.Media.Media3DVector3D
out - normalized ray direction

Return Value

Type: Boolean
true if rayOrigin and rayDirection were set or false if ray cannot be defined (usually when the size of TargetViewport3D is not known)
See Also