73 lines
3.4 KiB
C#
73 lines
3.4 KiB
C#
using UnityEngine;
|
|
|
|
namespace FishNet.Object.Prediction
|
|
{
|
|
/// <summary>
|
|
/// How to favor smoothing for predicted objects.
|
|
/// </summary>
|
|
internal enum AdaptiveSmoothingType
|
|
{
|
|
/// <summary>
|
|
/// Favor accurate collisions. With fast moving objects this may result in some jitter with higher latencies.
|
|
/// </summary>
|
|
Accuracy = 0,
|
|
/// <summary>
|
|
/// A mix between Accuracy and Smoothness.
|
|
/// </summary>
|
|
Mixed = 1,
|
|
/// <summary>
|
|
/// Prefer smooth movement and corrections. Fast moving objects may collide before the graphical representation catches up.
|
|
/// </summary>
|
|
Gradual = 2,
|
|
/// <summary>
|
|
/// Configure values to your preference.
|
|
/// </summary>
|
|
Custom = 3,
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct AdaptiveInterpolationSmoothingData
|
|
{
|
|
[HideInInspector, System.NonSerialized]
|
|
public bool SmoothPosition;
|
|
[HideInInspector, System.NonSerialized]
|
|
public bool SmoothRotation;
|
|
[HideInInspector, System.NonSerialized]
|
|
public bool SmoothScale;
|
|
[HideInInspector,System.NonSerialized]
|
|
public Transform GraphicalObject;
|
|
[HideInInspector,System.NonSerialized]
|
|
public NetworkObject NetworkObject;
|
|
[HideInInspector, System.NonSerialized]
|
|
public float TeleportThreshold;
|
|
/// <summary>
|
|
/// Percentage of ping to use as interpolation. Higher values will result in more interpolation.
|
|
/// </summary>
|
|
[Tooltip("Percentage of ping to use as interpolation. Higher values will result in more interpolation.")]
|
|
[Range(0.01f, 5f)]
|
|
public float InterpolationPercent;
|
|
/// <summary>
|
|
/// Percentage of ping to use as interpolation when colliding with an object local client owns.
|
|
/// This is used to speed up local interpolation when predicted objects collide with a player as well keep graphics closer to the objects root while colliding.
|
|
/// </summary>
|
|
[Tooltip("Percentage of ping to use as interpolation when colliding with an object local client owns." +
|
|
"This is used to speed up local interpolation when predicted objects collide with a player as well keep graphics closer to the objects root while colliding.")]
|
|
[Range(0.01f, 5f)]
|
|
public float CollisionInterpolationPercent;
|
|
/// <summary>
|
|
/// How much per tick to decrease to collision interpolation when colliding with a local player object.
|
|
/// Higher values will set interpolation to collision settings faster.
|
|
/// </summary>
|
|
[Tooltip("How much per tick to decrease to collision interpolation when colliding with a local player object. Higher values will set interpolation to collision settings faster.")]
|
|
[Range(1, byte.MaxValue)]
|
|
public byte InterpolationDecreaseStep;
|
|
/// <summary>
|
|
/// How much per tick to increase to normal interpolation when not colliding with a local player object.
|
|
/// Higher values will set interpolation to normal settings faster.
|
|
/// </summary>
|
|
[Tooltip("How much per tick to increase to normal interpolation when not colliding with a local player object. Higher values will set interpolation to normal settings faster.")]
|
|
[Range(1, byte.MaxValue)]
|
|
public byte InterpolationIncreaseStep;
|
|
}
|
|
|
|
} |