Description
The Normal
field of the SceneTraceResult
struct represents the surface normal at the point of impact during a trace operation. This is a direction vector that is perpendicular to the surface that was hit, providing information about the orientation of the surface at the hit location.
Usage
Use the Normal
field to determine the orientation of the surface that was hit during a trace. This can be useful for calculating reflections, determining surface properties, or for physics calculations where the direction of the surface is relevant.
Example
// Example of using the Normal field in a trace operation
Scene scene = new Scene();
PhysicsTraceResult physicsResult;
SceneTraceResult traceResult = SceneTraceResult.From(ref scene, ref physicsResult);
if (traceResult.Hit)
{
Vector3 hitNormal = traceResult.Normal;
// Use hitNormal for further calculations, such as determining reflection direction
Vector3 reflectionDirection = Vector3.Reflect(traceResult.Direction, hitNormal);
}