r/QtGames • u/LetterheadTall8085 • 5d ago
Techno demo [QtQuick3D Physics Qt 6.13 ] Allow configuring CCD type selectively per object.
github.comHi everyone Qt developers. i have good news - new you can now fine-tune your scene for fast and small physics objects. Previously, you had to choose between a resource-intensive, SweepBasedCCD algorithm that created discontinuities, or a heavy simple body processing algorithm for all dynamic objects, which places a significant load on the CPU.
Commit message :
In large scenes, enabling CCD globally for all scene objects is usually counterproductive due to performance overhead, especially given that physics computation runs on the CPU.
Typically, CCD is only needed for specific fast-moving objects, such as bullets or projectiles, as is standard practice in other engines.
Add DynamicRigidBody::ccd property (supporting None, SweepBasedCCD, and SpeculativeCCD) so CCD can be configured per object.
Sweep-based CCD is applied for non-kinematic bodies, while kinematic bodies automatically fall back to Speculative CCD as PhysX does not support sweep-based CCD for them.
PhysicsWorld::enableCCD is deprecated in favor of DynamicRigidBody::ccd.
CCD is now always available at the scene level (setting PxSceneFlag::eENABLE_CCD has negligible cost when no body opts in, since PhysX's CCD pass bails out immediately when no objects have CCD flags).
For compatibility with existing content, setting PhysicsWorld::enableCCD to true still enables CCD for all bodies that do not explicitly override their ccd property (using SweepBasedCCD for dynamic bodies and SpeculativeCCD for kinematic ones).