bool Sleeping { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Sleeping property of the PhysicsGroup class indicates whether the physics bodies within the group are currently in a "sleeping" state. Physics bodies automatically enter this state after a period of inactivity to optimize performance. This property can be used to manually wake up the bodies or force them into a sleeping state.

Usage

To use the Sleeping property, you can simply get or set its value on an instance of PhysicsGroup. Setting it to true will put the bodies to sleep, while setting it to false will wake them up.

Example

// Example of using the Sleeping property
PhysicsGroup physicsGroup = new PhysicsGroup();

// Check if the physics group is sleeping
bool isSleeping = physicsGroup.Sleeping;

// Wake up the physics group if it is sleeping
if (isSleeping)
{
    physicsGroup.Sleeping = false;
}

// Put the physics group to sleep
physicsGroup.Sleeping = true;