Description
The Ray
method in the PhysicsTraceBuilder
class is used to define a ray trace from a starting point to an ending point in 3D space. This method is part of the physics tracing system in s&box, which allows for precise collision detection and interaction with the game world.
Usage
To use the Ray
method, you need to provide two Vector3
references that represent the start and end points of the ray. This method returns a PhysicsTraceBuilder
object, allowing for method chaining to further configure the trace.
Example
// Example of using the Ray method in PhysicsTraceBuilder
Vector3 startPoint = new Vector3(0, 0, 0);
Vector3 endPoint = new Vector3(10, 0, 0);
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder.Ray(ref startPoint, ref endPoint);
// Further configuration and execution of the trace
PhysicsTraceResult result = traceBuilder.Run();
if (result.Hit)
{
// Handle the hit result
Entity hitEntity = result.Entity;
// Perform actions based on the hit entity
}