Click or drag to resize
AB4D logo

BaseCameraCreateOrthographicMouseRay3D Method

CreateOrthographicMouseRay3D is used for orthographic camera and calculates a normalized 3D ray that goes from the mouse position into the 3D scene for an Orthographic camera. The ray goes from rayOrigin in the rayDirection. If the ray cannot be calculated this method returns false. For perspective camera use CreatePerspectiveMouseRay3D(Point, Size, Matrix3D, Matrix3D, Point3D, Vector3D) or use non-static CreateMouseRay3D(Point, Point3D, Vector3D) method.

Namespace:  Ab3d.Cameras
Assembly:  Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 10.1.8147.1045
Syntax
C#
public static void CreateOrthographicMouseRay3D(
	Point mousePosition,
	Size viewportSize,
	Point3D cameraPosition,
	Vector3D lookDirection,
	Vector3D upDirection,
	double cameraWidth,
	double nearPlaneDistance,
	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)
cameraPosition
Type: System.Windows.Media.Media3DPoint3D
position of the camera
lookDirection
Type: System.Windows.Media.Media3DVector3D
camera's look direction vector (no need to be normalized)
upDirection
Type: System.Windows.Media.Media3DVector3D
camera's up direction vector (no need to be normalized)
cameraWidth
Type: SystemDouble
width of the orthographic camera
nearPlaneDistance
Type: SystemDouble
near plane distance
rayOrigin
Type: System.Windows.Media.Media3DPoint3D
out - ray origin
rayDirection
Type: System.Windows.Media.Media3DVector3D
out - normalized ray direction
See Also