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 operations.
Usage
To use the GetRay
method, you need to have an instance of SceneCamera
. You can then call this method by passing a Vector3
representing the cursor's position in the scene. The method will return a Ray
object that starts from the camera's position and points in the direction of the cursor position.
Example
// Assume 'camera' is an instance of SceneCamera
Vector3 cursorPosition = new Vector3(100, 200, 0); // Example cursor position
Ray ray = camera.GetRay(cursorPosition);
// Use the ray for further operations, such as raycasting
// Example: Check if the ray intersects with any objects in the scene