private Trfm Generate(Transform transform) { var data = new TimedTrfm().Set(Time.time, Trfm.Convert(transform, mRecordType)); mRecords.Add(data); return(data.Value); }
public static CheckedRet <object> Deserial(ByteList bytes) { var size = bytes.DropInt32(); if (bytes.Count != size) { return(CheckedRet <object> .Fail()); } var ret = new Trfm(); for (int i = 0; i < 3; i++) { var _size = bytes.DropInt32(); var _bytes = bytes.DropRange(0, _size); var _obj = Serializer.Deserialize <Vec3>(_bytes); if (_obj.Key == false) { return(CheckedRet <object> .Fail()); } ret.mVal [i] = _obj.Value; } // 小数点に関わるため、ハッシュチェックはしない(できない) return(CheckedRet <object> .Gen(true, ret)); }
public Trfm DeltaAvarage(int a, int b) { var deltaTimedTrfm = Delta(a, b); var dv = deltaTimedTrfm.Value; return(Trfm.Multiple(dv, 1 / deltaTimedTrfm.Key)); }
private void Update() { mSync.Sync(); var type = mIsLocal ? Trfm.Type.Local : Trfm.Type.World; var now = Trfm.Convert(transform, type); mSync.UpdateSend(() => { return(mSync.Prev != now); }, now); }
public static Trfm Add(Trfm a, Trfm b) { var ret = new Trfm { POS = Vec3.Add(a.POS, b.POS), ROT = Vec3.Add(a.ROT, b.ROT), SCA = Vec3.Add(a.SCA, b.SCA), }; return(ret); }
public static Trfm Multiple(Trfm a, float num) { var ret = new Trfm { POS = Vec3.Multiple(a.POS, num), ROT = Vec3.Multiple(a.ROT, num), SCA = Vec3.Multiple(a.SCA, num), }; return(ret); }
/// <summary> /// ローカルとワールドそれぞれに合わせて、 /// 目標位置にイージングで近づく /// </summary> private void SyncUpdate(Trfm e) { var pos_from = mIsLocal ? transform.localPosition : transform.position; var pos_set = mIsLocal ? (Action <Vector3>)transform.MoveToLocal : transform.MoveTo; pos_set(Vector3.Lerp(pos_from, e.POS.Convert(), mSpeed)); var rot_from = mIsLocal ? transform.localRotation : transform.rotation; var rot_set = mIsLocal ? (Action <Quaternion>)transform.RotateToLocal : transform.RotateTo; rot_set(Quaternion.Lerp(rot_from, Quaternion.Euler(e.ROT.Convert()), mSpeed)); }
public TimedTrfm Delta(int a, int b) { var ret = new TimedTrfm(); if (a == b) { return(ret.Set(0, new Trfm())); } if (a > b) { Switch(ref a, ref b); } var _a = mRecords [a]; var _b = mRecords [b]; var delta = _b.Key - _a.Key; var d = Trfm.Add(_b.Value, Trfm.Multiple(_a.Value, -1)); return(ret.Set(delta, d)); }
public void DebugPrintTransform() { DebugLog.Log.Print("{0}{1} " , gameObject.name , Trfm.Convert(transform, Trfm.Type.Local).ToJson()); }