From 2ccf2b6a1567417d7c83398897aae28550ad3857 Mon Sep 17 00:00:00 2001 From: mischa Date: Tue, 12 Mar 2024 19:01:22 +0800 Subject: [PATCH] reduce impact force --- Assets/Mirror/Core/Prediction/Prediction.cs | 8 ++++---- .../Mirror/Examples/Shooter/Prefabs/Weapons/Sniper.prefab | 6 +----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Assets/Mirror/Core/Prediction/Prediction.cs b/Assets/Mirror/Core/Prediction/Prediction.cs index d66994527..acf30231d 100644 --- a/Assets/Mirror/Core/Prediction/Prediction.cs +++ b/Assets/Mirror/Core/Prediction/Prediction.cs @@ -117,10 +117,10 @@ public static T CorrectHistory( afterIndex -= 1; // we removed the first value so all indices are off by one now } - // PERFORMANCE OPTIMIZATION: avoid O(N) insertion, only readjust all values after. - // the end result is the same since after.delta and after.position are both recalculated. - // it's technically not correct if we were to reconstruct final position from 0..after..end but - // we never do, we only ever iterate from after..end! + // PERFORMANCE OPTIMIZATION: avoid O(N) insertion, only readjust successive values. + // => end result is exactly same since we would readjust after.delta & after.position based on correction either way. + // => the only difference is we don't insert the correction + // => but since we only ever iterate from after..end, it doesn't matter if the correction is there or not! // // insert the corrected state into the history, or overwrite if already exists // SortedList insertions are O(N)! diff --git a/Assets/Mirror/Examples/Shooter/Prefabs/Weapons/Sniper.prefab b/Assets/Mirror/Examples/Shooter/Prefabs/Weapons/Sniper.prefab index 26f11fabe..aa9c80688 100644 --- a/Assets/Mirror/Examples/Shooter/Prefabs/Weapons/Sniper.prefab +++ b/Assets/Mirror/Examples/Shooter/Prefabs/Weapons/Sniper.prefab @@ -303,7 +303,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: muzzleFlash: {fileID: 7142436933463270085} - impactForce: 1000 + impactForce: 200 --- !u!1 &8751592387390054513 GameObject: m_ObjectHideFlags: 0 @@ -392,7 +392,6 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - serializedVersion: 3 m_TransformParent: {fileID: 7629472450998371511} m_Modifications: - target: {fileID: 650646081168667483, guid: 1b3fd1dec89b44c44a152f3710e1191a, @@ -466,9 +465,6 @@ PrefabInstance: value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 1b3fd1dec89b44c44a152f3710e1191a, type: 3} --- !u!4 &3796838284988201912 stripped Transform: