private void Interpolate(NetworkTransformSnapshot interpolated) { if (_syncPosition) { transform.localPosition = interpolated.position; } if (_syncRotation) { transform.localRotation = interpolated.rotation; } if (_syncScale) { transform.localScale = interpolated.scale; } }
public void SyncSnapshot(NeutronStream.IReader reader, NeutronPlayer player) { var position = _syncPosition ? reader.ReadVector3() : Vector3.zero; var rotation = _syncRotation ? _compressQuaternion ? reader.ReadCompressedQuaternion(_floatMultiplicationPrecision) : reader.ReadQuaternion() : Quaternion.identity; var scale = _syncScale ? reader.ReadVector3() : Vector3.zero; var timestamp = reader.ReadDouble(); if (_syncPosition) { OnTeleport(position); } NetworkTransformSnapshot snapshot = new NetworkTransformSnapshot( timestamp, LocalTime, position, rotation, scale ); lock (_bufferLock) SnapshotInterpolation.InsertIfNewEnough(snapshot, _buffer); }
private void Awake() { _rigidbody = GetComponent <Rigidbody2D>(); _photonView = GetComponent <PhotonView>(); _recentSnapshot = new NetworkTransformSnapshot(); }