mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-04 02:47:22 +00:00
SyncBase: rename leeway variables
This commit is contained in:
parent
b23c5ac1aa
commit
a32c0ce166
@ -16,7 +16,7 @@ namespace QSB.OrbSync.TransformSync
|
||||
protected override bool CheckValid() => AttachedTransform && base.CheckValid();
|
||||
|
||||
protected override bool UseInterpolation => true;
|
||||
protected override float DistanceLeeway => 1f;
|
||||
protected override float DistanceChangeThreshold => 1f;
|
||||
|
||||
protected override Transform InitLocalTransform() => _qsbOrb.AttachedObject.transform;
|
||||
protected override Transform InitRemoteTransform() => _qsbOrb.AttachedObject.transform;
|
||||
|
@ -118,10 +118,10 @@ namespace QSB.Syncs
|
||||
public override string ToString() => (IsPlayerObject ? $"{Player.PlayerId}." : string.Empty)
|
||||
+ $"{netId}:{GetType().Name} ({Name})";
|
||||
|
||||
protected virtual float DistanceLeeway => 5f;
|
||||
protected virtual float AngleLeeway => 5f;
|
||||
private float _prevDistance;
|
||||
private float _prevAngle;
|
||||
protected virtual float DistanceChangeThreshold => 5f;
|
||||
private const float AngleChangeThreshold = 90f;
|
||||
private float _prevDistance = float.MinValue;
|
||||
private float _prevAngle = float.MinValue;
|
||||
protected const float SmoothTime = 0.1f;
|
||||
private Vector3 _positionSmoothVelocity;
|
||||
private Quaternion _rotationSmoothVelocity;
|
||||
@ -265,13 +265,13 @@ namespace QSB.Syncs
|
||||
private void Interpolate()
|
||||
{
|
||||
var distance = Vector3.Distance(SmoothPosition, transform.position);
|
||||
SmoothPosition = Mathf.Abs(distance - _prevDistance) > DistanceLeeway ?
|
||||
SmoothPosition = Mathf.Abs(distance - _prevDistance) > DistanceChangeThreshold ?
|
||||
transform.position :
|
||||
Vector3.SmoothDamp(SmoothPosition, transform.position, ref _positionSmoothVelocity, SmoothTime);
|
||||
_prevDistance = distance;
|
||||
|
||||
var angle = Quaternion.Angle(SmoothRotation, transform.rotation);
|
||||
SmoothRotation = Mathf.Abs(angle - _prevAngle) > AngleLeeway ?
|
||||
SmoothRotation = Mathf.Abs(angle - _prevAngle) > AngleChangeThreshold ?
|
||||
transform.rotation :
|
||||
QuaternionHelper.SmoothDamp(SmoothRotation, transform.rotation, ref _rotationSmoothVelocity, SmoothTime);
|
||||
_prevAngle = angle;
|
||||
|
@ -14,7 +14,7 @@ namespace QSB.Tools.ProbeTool.TransformSync
|
||||
/// </summary>
|
||||
protected override bool CheckValid() => AttachedTransform && base.CheckValid();
|
||||
|
||||
protected override float DistanceLeeway => 10f;
|
||||
protected override float DistanceChangeThreshold => 10f;
|
||||
protected override bool UseInterpolation => true;
|
||||
protected override bool AllowInactiveAttachedObject => true;
|
||||
protected override bool IsPlayerObject => true;
|
||||
|
Loading…
Reference in New Issue
Block a user