Surface Surface

robot_2Generated
code_blocksInput

Description

The Surface field in the SceneTraceResult struct represents the physical properties of the surface that was hit during a scene trace operation. This field is of type Sandbox.Surface and provides detailed information about the material and characteristics of the surface encountered by the trace.

Usage

Use the Surface field to access the physical properties of the surface that was hit in a trace operation. This can be useful for determining how an object should interact with the surface, such as applying different physics or visual effects based on the surface type.

Example

// Example of using the Surface field in a SceneTraceResult
SceneTraceResult traceResult = SceneTraceResult.From(scene, trace);

if (traceResult.Hit)
{
    Sandbox.Surface hitSurface = traceResult.Surface;
    // Use hitSurface to determine interactions or effects
    // For example, check if the surface is slippery
    if (hitSurface.IsSlippery)
    {
        // Apply slippery effect
    }
}