Description
The Surface
property of the PhysicsBody
class represents the surface characteristics of the physics body. It is of type Sandbox.Surface
, which encapsulates various surface properties such as friction and restitution that affect how the physics body interacts with other surfaces.
Usage
Use the Surface
property to get or set the surface characteristics of a PhysicsBody
. This can be useful for customizing how the physics body behaves when it comes into contact with other objects, such as adjusting friction or bounciness.
Example
// Example of setting the Surface property
PhysicsBody myPhysicsBody = new PhysicsBody();
myPhysicsBody.Surface = new Surface
{
Friction = 0.5f,
Restitution = 0.3f
};
// Accessing the Surface property
Surface currentSurface = myPhysicsBody.Surface;
float friction = currentSurface.Friction;
float restitution = currentSurface.Restitution;