Hitbox Hitbox

book_4_sparkGenerated
code_blocksInput

Description

The Hitbox field in the SceneTraceResult struct represents the specific hitbox that was intersected during a scene trace operation. This field is part of the Hit Object group and is marked as read-only, indicating that it is set during the trace operation and should not be modified afterwards.

Usage

Use the Hitbox field to determine which hitbox was hit during a trace. This can be useful for collision detection, damage calculation, or any other logic that depends on knowing the specific hitbox that was intersected.

Example

// Example of using SceneTraceResult to access the Hitbox
SceneTraceResult traceResult = SceneTraceResult.From(scene, trace);

if (traceResult.Hit)
{
    Hitbox hitbox = traceResult.Hitbox;
    // Perform operations with the hitbox
    // For example, check if the hitbox is part of a specific GameObject
    if (hitbox != null)
    {
        // Logic based on the hitbox
    }
}