PhysicsInfo

@three-blocks/proPerformanceMetricsDebug
new PhysicsInfo(physicsAPI : Physics)
Access
Public

Physics Info - Performance Metrics and Analytics

Provides real-time physics performance metrics and body analytics, similar to Three.js's renderer.info pattern.

All metrics are lazily evaluated via getters, reading directly from SharedArrayBuffer views for minimal overhead.

Constructor Parameters
The Physics instance to read metrics from
Example
const physics = new Physics();
await physics.init();

// Access timing metrics
console.log(physics.info.timing.fps);       // Physics FPS
console.log(physics.info.timing.stepTime);  // Step execution time (ms)

// Access body counts
console.log(physics.info.bodies.total);     // Total body slots
console.log(physics.info.bodies.active);    // Total active bodies
console.log(physics.info.bodies.dynamic);   // { active: 1, total: 16 }

// Access body state aggregates
console.log(physics.info.state.grounded);   // Bodies touching ground
console.log(physics.info.state.sleeping);   // Bodies in sleep state

Properties

.physicsModel :

Get the active physics model.

.bodies :

Body counts - total summary and per-type breakdown.

.timing :

Performance timing metrics.

.state :

Body state aggregates (for dynamic bodies).

.collisions :

Collision tracking metrics.

.memory :

Memory usage metrics.

Methods

reset#

reset()

Reset any frame-specific counters. Currently a placeholder for future use.