Description
The Trace
property of the EditorTool
class provides a mechanism to create a scene trace against the current scene using the current mouse cursor position. This property is useful for determining what objects or elements are under the cursor within the scene, allowing for interactions such as selection or manipulation.
Usage
To use the Trace
property, you typically access it within an editor tool that extends EditorTool
. The property returns a SceneTrace
object, which can be used to gather information about the scene at the cursor's location.
Example usage:
public class MyCustomTool : EditorTool
{
public override void OnUpdate()
{
// Perform a trace using the current mouse cursor position
SceneTrace traceResult = this.Trace;
if (traceResult.Hit)
{
// Handle the trace result, e.g., highlight the object
GameObject hitObject = traceResult.Entity;
// Perform operations on hitObject
}
}
}
Example
public class MyCustomTool : EditorTool
{
public override void OnUpdate()
{
// Perform a trace using the current mouse cursor position
SceneTrace traceResult = this.Trace;
if (traceResult.Hit)
{
// Handle the trace result, e.g., highlight the object
GameObject hitObject = traceResult.Entity;
// Perform operations on hitObject
}
}
}