PhysicsTraceBuilder PhysicsTrace { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The PhysicsTrace property provides a static instance of PhysicsTraceBuilder that allows you to perform physics-based tracing operations within the current scene. This is useful for detecting collisions, raycasting, and other physics interactions in the game environment.

Usage

Use the PhysicsTrace property to initiate a physics trace operation. You can configure the trace by setting various parameters on the PhysicsTraceBuilder instance, such as the start and end points, collision filters, and more. Once configured, you can execute the trace to obtain results about what the trace intersects with in the scene.

Example

// Example of using PhysicsTrace to perform a raycast
var traceResult = Game.PhysicsTrace
    .From(startPosition)
    .To(endPosition)
    .Run();

if (traceResult.Hit)
{
    // Handle the hit result
    var hitEntity = traceResult.Entity;
    // Do something with the hit entity
}