public SnapShot GetSnapshot(ulong timestep) { SnapShot lower; SnapShot upper; if (FindSnapshots(timestep, out lower, out upper)) { float t = (timestep - lower.tick) / (float)(upper.tick - lower.tick); //Debug.LogFormat("UpdateSnapshot: {0} {1} {2} {3}", t, lower.tick, timestep, upper.tick); return(new SnapShot() { tick = timestep, position = InterpolateVector3.Interpolate(lower.position, upper.position, t), rotation = InterpolateQuaternion.Interpolate(lower.rotation, upper.rotation, t), velocity = InterpolateVector3.Interpolate(lower.velocity, upper.velocity, t), Health = Interpolated <int> .Interpolate(lower.Health, upper.Health, t), LastCommand = Interpolated <ulong> .Interpolate(lower.LastCommand, upper.LastCommand, t), }); } else { ulong start; ulong end; int count; GetSnapShotWindow(out start, out end, out count); float t = (timestep - start) / (float)(end - start); Debug.LogFormat("UpdateSnapshot: {0} {1} {2} {3} {4}", t, start, timestep, end, count); } return(new SnapShot()); }
public BulletInterPolation(uint serverObjID, InterpolateVector3 pos, GameObject obj) { this.Position = pos; this.serverObjID = serverObjID; this.obj = obj; }