diff --git a/configs/configs.xml b/configs/configs.xml index f6f3d49..c90be1d 100644 --- a/configs/configs.xml +++ b/configs/configs.xml @@ -42,6 +42,9 @@ calculate the maximumActiveSkeletons. Increasing sample size will flatten outliers but can slow adjustment responsiveness. Default is 5. --> 5 + + false true diff --git a/hdtSMP64/ActorManager.cpp b/hdtSMP64/ActorManager.cpp index 29affab..fb3d735 100644 --- a/hdtSMP64/ActorManager.cpp +++ b/hdtSMP64/ActorManager.cpp @@ -196,7 +196,7 @@ namespace hdt i.skeleton = nullptr; } else if (i.hasPhysics && i.updateAttachedState(playerCell, activeSkeletons >= maxActiveSkeletons)) - activeSkeletons++; + activeSkeletons++; } m_skeletons.erase( @@ -752,8 +752,14 @@ namespace hdt { if (isPlayerCharacter()) { - isActive = true; - state = SkeletonState::e_ActiveIsPlayer; + // That setting defines whether we don't set the PC skeleton as active + // when it is in 1st person view, to avoid calculating physics uselessly. + if (!(instance()->m_disable1stPersonViewPhysics // disabling? + && PlayerCamera::GetSingleton()->cameraState == PlayerCamera::GetSingleton()->cameraStates[0])) // 1st person view + { + isActive = true; + state = SkeletonState::e_ActiveIsPlayer; + } } else if (isInPlayerView()) { diff --git a/hdtSMP64/ActorManager.h b/hdtSMP64/ActorManager.h index c0f467d..80593ab 100644 --- a/hdtSMP64/ActorManager.h +++ b/hdtSMP64/ActorManager.h @@ -193,6 +193,10 @@ namespace hdt bool m_autoAdjustMaxSkeletons = true; // Whether to dynamically change the maxActive skeletons to maintain min_fps int m_maxActiveSkeletons = 20; // The maximum active skeletons; hard limit int m_sampleSize = 5; // how many samples (each sample taken every second) for determining average time per activeSkeleton. + + // @brief Depending on this setting, we avoid to calculate the physics of the PC when it is in 1st person view. + bool m_disable1stPersonViewPhysics = false; + private: void setSkeletonsActive(); }; diff --git a/hdtSMP64/config.cpp b/hdtSMP64/config.cpp index c0e7df2..537000b 100644 --- a/hdtSMP64/config.cpp +++ b/hdtSMP64/config.cpp @@ -108,6 +108,8 @@ namespace hdt } else if (reader.GetLocalName() == "sampleSize") ActorManager::instance()->m_sampleSize = std::max(reader.readInt(), 1); + else if (reader.GetLocalName() == "disable1stPersonViewPhysics") + ActorManager::instance()->m_disable1stPersonViewPhysics = reader.readBool(); else { _WARNING("Unknown config : %s", reader.GetLocalName());