Description
The AddCollisionSphere
method is used to add a spherical collision shape to a model being constructed with the ModelBuilder
. This method allows you to specify the radius and center of the sphere, which will be used to define the collision boundaries of the model.
Usage
To use the AddCollisionSphere
method, you need to have an instance of ModelBuilder
. Call this method on the instance, passing the desired radius and center position of the sphere as parameters. This method returns the ModelBuilder
instance, allowing for method chaining.
Example
// Create a new ModelBuilder instance
ModelBuilder builder = new ModelBuilder();
// Define the radius and center of the collision sphere
float radius = 1.5f;
Vector3 center = new Vector3(0, 0, 0);
// Add a collision sphere to the model
builder.AddCollisionSphere(radius, center);
// Continue building the model or finalize it
Model model = builder.Create();