Description
The EnableSolidCollisions
property of the PhysicsBody
class is used to manage solid collision settings for all shapes associated with the physics body. When set, it applies the EnableSolidCollisions
setting to each PhysicsShape
within the body. The property returns true
if any of the shapes have solid collisions enabled, otherwise it returns false
.
Usage
To use the EnableSolidCollisions
property, simply access it through an instance of PhysicsBody
. You can set it to true
or false
to enable or disable solid collisions for all shapes in the body, respectively. This is useful for controlling whether the physics body should interact with other solid objects in the simulation.
Example
// Example of using EnableSolidCollisions
PhysicsBody myPhysicsBody = new PhysicsBody();
// Enable solid collisions for all shapes in the physics body
myPhysicsBody.EnableSolidCollisions = true;
// Check if any shapes have solid collisions enabled
bool hasSolidCollisions = myPhysicsBody.EnableSolidCollisions;
// Output the result
// Note: Use a logging system instead of Console.WriteLine
// Log.Info($"Solid Collisions Enabled: {hasSolidCollisions}");