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

robot_2Generated
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 the scene and detecting any collisions along the path.

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 used to further configure the trace or execute it to get results.

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
    var hitEntity = result.Entity;
    // Do something with the hit entity
}