SceneTrace Body( Rigidbody body, Vector3& to )
SceneTrace Body( PhysicsBody body, Transform& from, Vector3& to )

book_4_sparkGenerated
code_blocksInput

Description

The Body method in the SceneTrace struct is used to cast a PhysicsBody from its current position and rotation to a specified end point. This method is useful for simulating the movement of a physical object through a scene, checking for collisions along the way.

Usage

To use the Body method, you need to provide a PhysicsBody instance and a target end point as a Vector3. The method will return a SceneTrace object that can be further configured or executed to perform the trace.

Example

// Example usage of SceneTrace.Body
PhysicsBody myBody = new PhysicsBody();
Vector3 targetPosition = new Vector3(10, 0, 0);

SceneTrace trace = SceneTrace.Body(myBody, ref targetPosition);
SceneTraceResult result = trace.Run();

if (result.Hit)
{
    // Handle collision
    Console.WriteLine("Collision detected at: " + result.Position);
}