Description
The Surface
field of the SceneTraceResult
struct represents the physical properties of the surface that was hit during a scene trace operation. This field provides detailed information about the material characteristics of the surface, which can be used to determine how the surface interacts with other objects, such as how it reflects light or how it affects physics calculations.
Usage
To access the Surface
field, you must first perform a scene trace operation that returns a SceneTraceResult
object. Once you have this result, you can access the Surface
field to retrieve information about the hit surface's physical properties.
Example
// Example of accessing the Surface field from a SceneTraceResult
// Assume 'traceResult' is a valid SceneTraceResult obtained from a trace operation
Sandbox.SceneTraceResult traceResult = PerformSceneTrace();
// Access the Surface field
Sandbox.Surface hitSurface = traceResult.Surface;
// Use the hitSurface to determine properties like friction, bounce, etc.
float friction = hitSurface.Friction;
float bounce = hitSurface.Bounce;