Description
The CursorRay
property of the SceneRenderingWidget
class provides a Ray
that represents the direction and origin of a ray cast from the current cursor position within the scene. This is particularly useful for determining what objects or surfaces the cursor is pointing at in a 3D space, enabling interactions such as object selection or manipulation.
Usage
To use the CursorRay
property, you need to have an instance of the SceneRenderingWidget
class. Access the property directly to get the ray corresponding to the current cursor position. This can be used in various scene interaction scenarios, such as detecting which objects are under the cursor.
Example
// Assuming 'sceneWidget' is an instance of SceneRenderingWidget
Ray cursorRay = sceneWidget.CursorRay;
// Use the ray to perform a raycast or other operations
// For example, checking what the ray intersects with in the scene
var hitInfo = sceneWidget.Scene.Raycast(cursorRay);
if (hitInfo != null)
{
// Process the hit information, such as selecting an object
var hitObject = hitInfo.Entity;
// Perform operations on the hit object
}