fix(PredictedRigidbody): increase default motion smoothing angular velocity threshold

This commit is contained in:
mischa 2024-03-28 21:27:17 +08:00 committed by MrGadget
parent c6158acbc2
commit 41c811afa8
3 changed files with 5 additions and 5 deletions

View File

@ -35,7 +35,7 @@ public class PredictedRigidbody : NetworkBehaviour
[Tooltip("Smoothing via Ghost-following only happens on demand, while moving with a minimum velocity.")] [Tooltip("Smoothing via Ghost-following only happens on demand, while moving with a minimum velocity.")]
public float motionSmoothingVelocityThreshold = 0.1f; public float motionSmoothingVelocityThreshold = 0.1f;
float motionSmoothingVelocityThresholdSqr; // ² cached in Awake float motionSmoothingVelocityThresholdSqr; // ² cached in Awake
public float motionSmoothingAngularVelocityThreshold = 0.1f; public float motionSmoothingAngularVelocityThreshold = 5.0f; // Billiards demo: 0.1 is way too small, takes forever for IsMoving()==false
float motionSmoothingAngularVelocityThresholdSqr; // ² cached in Awake float motionSmoothingAngularVelocityThresholdSqr; // ² cached in Awake
public float motionSmoothingTimeTolerance = 0.5f; public float motionSmoothingTimeTolerance = 0.5f;
double motionSmoothingLastMovedTime; double motionSmoothingLastMovedTime;
@ -581,8 +581,8 @@ void RecordState()
protected virtual void OnSnappedIntoPlace() {} protected virtual void OnSnappedIntoPlace() {}
protected virtual void OnBeforeApplyState() {} protected virtual void OnBeforeApplyState() {}
protected virtual void OnCorrected() {} protected virtual void OnCorrected() {}
protected virtual void OnBeginPrediction() {} // when the Rigidbody moved above threshold and we created a ghost protected virtual void OnBeginPrediction() => Debug.LogWarning($"BEGIN: {name}"); // when the Rigidbody moved above threshold and we created a ghost
protected virtual void OnEndPrediction() {} // when the Rigidbody came to rest and we destroyed the ghost protected virtual void OnEndPrediction() => Debug.LogWarning($"END: {name}"); // when the Rigidbody came to rest and we destroyed the ghost
void ApplyState(double timestamp, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 angularVelocity) void ApplyState(double timestamp, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 angularVelocity)
{ {

View File

@ -166,7 +166,7 @@ MonoBehaviour:
syncInterval: 0 syncInterval: 0
predictedRigidbody: {fileID: -177125271246800426} predictedRigidbody: {fileID: -177125271246800426}
motionSmoothingVelocityThreshold: 0.1 motionSmoothingVelocityThreshold: 0.1
motionSmoothingAngularVelocityThreshold: 0.1 motionSmoothingAngularVelocityThreshold: 5
motionSmoothingTimeTolerance: 0.5 motionSmoothingTimeTolerance: 0.5
stateHistoryLimit: 32 stateHistoryLimit: 32
recordInterval: 0.05 recordInterval: 0.05

View File

@ -302,7 +302,7 @@ MonoBehaviour:
syncInterval: 0 syncInterval: 0
predictedRigidbody: {fileID: 1848203816128897140} predictedRigidbody: {fileID: 1848203816128897140}
motionSmoothingVelocityThreshold: 0.1 motionSmoothingVelocityThreshold: 0.1
motionSmoothingAngularVelocityThreshold: 0.1 motionSmoothingAngularVelocityThreshold: 5
motionSmoothingTimeTolerance: 0.5 motionSmoothingTimeTolerance: 0.5
stateHistoryLimit: 32 stateHistoryLimit: 32
recordInterval: 0.05 recordInterval: 0.05