Description
The LinearDamping
property of the PhysicsGroup
class is used to set the linear damping on all physics bodies within the group. Linear damping is a factor that reduces the velocity of a body over time, simulating the effect of drag or friction in a medium like air or water. This property directly affects the LinearDamping
of each PhysicsBody
in the group, allowing for consistent behavior across all bodies.
Usage
To use the LinearDamping
property, simply assign a float
value to it. This value will be applied to all physics bodies within the PhysicsGroup
. A higher value will result in more rapid deceleration of the bodies' linear motion.
Example
// Create a new PhysicsGroup
PhysicsGroup physicsGroup = new PhysicsGroup();
// Set the linear damping for all bodies in the group
physicsGroup.LinearDamping = 0.5f;
// This will apply a linear damping of 0.5 to each PhysicsBody in the group,
// causing them to slow down more quickly when moving.