diff options
| author | Léo Lam <leo@leolam.fr> | 2022-03-20 15:08:26 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2022-03-20 15:11:28 +0100 |
| commit | a98e5f65579055d72a8c72201b0c7f119ec8d242 (patch) | |
| tree | 897a59e3bc0f43da411d2481ea9a3a1236279277 /src/KingSystem/Physics/System/physShapeCast.cpp | |
| parent | cc270ee3ff82d7766dcbc0eee54cdc34d09bff4c (diff) | |
ksys/phys: Add ScopedWorldLock to simplify world locking/unlocking
Diffstat (limited to 'src/KingSystem/Physics/System/physShapeCast.cpp')
| -rw-r--r-- | src/KingSystem/Physics/System/physShapeCast.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/KingSystem/Physics/System/physShapeCast.cpp b/src/KingSystem/Physics/System/physShapeCast.cpp index 024cb395..3b9904c7 100644 --- a/src/KingSystem/Physics/System/physShapeCast.cpp +++ b/src/KingSystem/Physics/System/physShapeCast.cpp @@ -86,22 +86,22 @@ bool ShapeCast::doExecuteQuery(hkpCdPointCollector& cast_collector, OnlyLockIfNeeded only_lock_if_needed) { const auto layer_type = mBody->getLayerType(); - System::instance()->lockWorld(layer_type, "shape_cast", 0, only_lock_if_needed); + { + ScopedWorldLock lock{layer_type, "shape_cast", 0, only_lock_if_needed}; - hkpLinearCastInput input; - loadFromVec3(&input.m_to, mTo); + hkpLinearCastInput input; + loadFromVec3(&input.m_to, mTo); - // Reset internal state. - cast_collector.reset(); - if (_44 == 1) - reset(); + // Reset internal state. + cast_collector.reset(); + if (_44 == 1) + reset(); - System::instance()->getHavokWorld(layer_type)->m_collisionInput->m_weldClosestPoints = - bool(weld_closest_points); + System::instance()->getHavokWorld(layer_type)->m_collisionInput->m_weldClosestPoints = + bool(weld_closest_points); - doCast(input, cast_collector, start_collector); - - System::instance()->unlockWorld(layer_type, "shape_cast", 0, only_lock_if_needed); + doCast(input, cast_collector, start_collector); + } // Register every point that is in start_collector. auto* body = mBody; |
