Ray GetRay( Vector3 cursorPosition )
Ray GetRay( Vector3 cursorPosition, Vector3 screenSize )

book_4_sparkGenerated
code_blocksInput

Description

The GetRay method of the SceneCamera class is used to generate a Ray from the camera's perspective, based on a given cursor position in 3D space. This is particularly useful for determining what objects in the scene are under the cursor or for raycasting purposes.

Usage

To use the GetRay method, you need to provide a Vector3 representing the cursor's position in the 3D space. The method will return a Ray object that starts from the camera's position and points in the direction of the cursor position.

Example

// Example usage of SceneCamera.GetRay
SceneCamera camera = new SceneCamera();
Vector3 cursorPosition = new Vector3(100, 200, 0); // Example cursor position
Ray ray = camera.GetRay(cursorPosition);

// Use the ray for raycasting or other purposes
// For example, checking if the ray intersects with any objects in the scene