void UpdateHull( Vector3 position, Rotation rotation, System.Span<Vector3> points )

book_4_sparkGenerated
code_blocksInput

Description

The UpdateHull method is used to update the hull of a PhysicsShape with a new set of points, position, and rotation. This method is essential for modifying the shape's geometry dynamically, allowing for changes in the physical representation of the object in the simulation.

Usage

To use the UpdateHull method, you need to provide the new position and rotation for the hull, as well as a collection of points that define the new shape. The points should be provided as a System.Span<Vector3>, which allows for efficient memory management and manipulation of the data.

Ensure that the points provided form a valid convex hull, as the method is designed to work with convex shapes only.

Example

// Example of using UpdateHull
PhysicsShape shape = new PhysicsShape();
Vector3 newPosition = new Vector3(1.0f, 2.0f, 3.0f);
Rotation newRotation = Rotation.From(45.0f, 0.0f, 0.0f);
Vector3[] newPoints = new Vector3[]
{
    new Vector3(0.0f, 0.0f, 0.0f),
    new Vector3(1.0f, 0.0f, 0.0f),
    new Vector3(0.0f, 1.0f, 0.0f),
    new Vector3(0.0f, 0.0f, 1.0f)
};

shape.UpdateHull(newPosition, newRotation, newPoints);