mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 06:35:45 +00:00
nre fix and cleanup
This commit is contained in:
parent
5bb2784c4f
commit
504e4c82e6
@ -36,7 +36,8 @@ namespace QSB.TransformSync
|
||||
|
||||
var transformSync = PlayerRegistry.GetTransformSync(message.SenderId);
|
||||
DebugLog.ToScreen($"{transformSync.GetType().Name} of ID {message.SenderId} set to {message.SectorName}");
|
||||
transformSync.SetReference(sector);
|
||||
UnityHelper.Instance.RunWhen(() => transformSync.SyncedTransform != null,
|
||||
() => transformSync.SetReference(sector));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ namespace QSB.TransformSync
|
||||
|
||||
private const float SmoothTime = 0.1f;
|
||||
private bool _isInitialized;
|
||||
private Transform _previousTransform;
|
||||
|
||||
public Transform SyncedTransform { get; private set; }
|
||||
public Sector ReferenceSector { get; set; }
|
||||
@ -103,12 +102,8 @@ namespace QSB.TransformSync
|
||||
public void SetReference(Sector sector)
|
||||
{
|
||||
ReferenceSector = sector;
|
||||
_positionSmoothVelocity = Vector3.zero;
|
||||
_rotationSmoothVelocity = Quaternion.identity;
|
||||
SyncedTransform.parent = ReferenceSector.transform;
|
||||
var difference = sector.transform.position - SyncedTransform.parent.position;
|
||||
SyncedTransform.parent = ReferenceSector.transform;
|
||||
SyncedTransform.localPosition = SyncedTransform.localPosition + difference;
|
||||
SyncedTransform.localPosition += sector.transform.position - SyncedTransform.parent.position;
|
||||
transform.position = ReferenceSector.transform.InverseTransformPoint(SyncedTransform.position);
|
||||
transform.rotation = ReferenceSector.transform.InverseTransformRotation(SyncedTransform.rotation);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user