string SurfaceMaterial { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The SurfaceMaterial property of the PhysicsBody class is used to set the surface material for all child PhysicsShape objects associated with this PhysicsBody. This property helps in defining the physical characteristics of the shapes, such as friction and restitution, based on the material type.

Usage

To use the SurfaceMaterial property, simply assign a string representing the material name to it. This will propagate the material setting to all child PhysicsShape objects. The property will return the most commonly occurring surface name among all the shapes.

Example

// Example of setting the SurfaceMaterial property
PhysicsBody physicsBody = new PhysicsBody();
physicsBody.SurfaceMaterial = "Concrete";

// This will set the surface material of all child PhysicsShapes to "Concrete".