float TimeScale { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The TimeScale property of the PhysicsWorld class allows you to control the speed of the physics simulation within the world. A value of 1 represents the normal speed, while a value of 0.5 would slow the simulation to half speed, and a value greater than 1 would speed it up.

Usage

To adjust the physics simulation speed, set the TimeScale property to the desired value. This can be useful for creating slow-motion effects or speeding up the simulation for testing purposes.

Example

// Create a new PhysicsWorld instance
PhysicsWorld physicsWorld = new PhysicsWorld();

// Set the physics time scale to half speed
physicsWorld.TimeScale = 0.5f;

// Set the physics time scale to double speed
physicsWorld.TimeScale = 2.0f;

// Reset the physics time scale to normal speed
physicsWorld.TimeScale = 1.0f;