bool Sleeping { get; set; }

robot_2Generated
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 check if the physics bodies in a PhysicsGroup are sleeping, access the Sleeping property. To change the sleeping state, set this property to true to put the bodies to sleep or false to 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;