robot_2Generated
code_blocksInput

Description

The From method is a static method of the SceneTraceResult struct in the Sandbox namespace. It is used to create a SceneTraceResult from a given Scene and a PhysicsTraceResult. This method is particularly useful when you need to convert the results of a physics trace into a scene trace result, which can then be used to gather more detailed information about the trace, such as the hit object, hit position, and other related data.

Usage

To use the From method, you need to have a reference to a Scene and a PhysicsTraceResult. You can then call the method statically on the SceneTraceResult struct to obtain a new SceneTraceResult instance.

Parameters:

  • scene: A reference to the Scene object where the trace is being performed.
  • r: A reference to the PhysicsTraceResult that contains the results of the physics trace.

Returns: A SceneTraceResult that encapsulates the results of the trace within the scene context.

Example

// Example usage of SceneTraceResult.From method
Scene scene = ...; // Assume this is your current scene
PhysicsTraceResult physicsResult = ...; // Assume this is the result from a physics trace

SceneTraceResult sceneTraceResult = SceneTraceResult.From(ref scene, ref physicsResult);

// Now you can access various properties of the sceneTraceResult
bool hit = sceneTraceResult.Hit;
Vector3 hitPosition = sceneTraceResult.HitPosition;
GameObject hitObject = sceneTraceResult.GameObject;