Vector3 Normal

book_4_sparkGenerated
code_blocksInput

Description

The Normal field of the SceneTraceResult struct represents the normal vector of the surface that was hit during a trace operation. This vector is a unit vector that is perpendicular to the surface at the point of impact, indicating the direction in which the surface is facing.

Usage

Use the Normal field to determine the orientation of the surface that was hit. This can be useful for calculating reflections, determining the angle of impact, or applying physics-based responses to collisions.

Example

// Example usage of SceneTraceResult.Normal
SceneTraceResult traceResult = Scene.Trace(...);

if (traceResult.Hit)
{
    Vector3 hitNormal = traceResult.Normal;
    // Use hitNormal for further calculations, such as reflection
    Vector3 reflection = Vector3.Reflect(incomingDirection, hitNormal);
}