diff --git a/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp b/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp index 80d264857..60da71ad3 100644 --- a/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp +++ b/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp @@ -1256,6 +1256,8 @@ void* PhysicsBackend::CreateScene(const PhysicsSettings& settings) sceneDesc.simulationEventCallback = &scenePhysX->EventsCallback; sceneDesc.filterShader = FilterShader; sceneDesc.bounceThresholdVelocity = settings.BounceThresholdVelocity; + if (settings.EnableEnhancedDeterminism) + sceneDesc.flags |= PxSceneFlag::eENABLE_ENHANCED_DETERMINISM; switch (settings.SolverType) { case PhysicsSolverType::ProjectedGaussSeidelIterativeSolver: diff --git a/Source/Engine/Physics/PhysicsSettings.h b/Source/Engine/Physics/PhysicsSettings.h index fca1ea2d4..728a18367 100644 --- a/Source/Engine/Physics/PhysicsSettings.h +++ b/Source/Engine/Physics/PhysicsSettings.h @@ -94,10 +94,16 @@ public: API_FIELD(Attributes="EditorOrder(71), EditorDisplay(\"Simulation\")") PhysicsBroadPhaseType BroadPhaseType = PhysicsBroadPhaseType::ParallelAutomaticBoxPruning; + /// + /// Enables enhanced determinism in the simulation. This has a performance impact. + /// + API_FIELD(Attributes="EditorOrder(71), EditorDisplay(\"Simulation\")") + bool EnableEnhancedDeterminism = false; + /// /// The solver type to use in the simulation. /// - API_FIELD(Attributes="EditorOrder(72), EditorDisplay(\"Simulation\")") + API_FIELD(Attributes="EditorOrder(73), EditorDisplay(\"Simulation\")") PhysicsSolverType SolverType = PhysicsSolverType::ProjectedGaussSeidelIterativeSolver; ///