public static TransformData GetTransformAtTime(RingBuffer <TransformData> history, long desiredTime) { for (int i = history.Count - 1; i > 0; i--) { if (history.Get(i).time >= desiredTime && history.Get(i - 1).time < desiredTime) { return(Lerp(history.Get(i - 1), history.Get(i), desiredTime)); } } if (history.Count > 0) { return(history.GetLatest()); } else { // No history data available. return(new TransformData() { time = desiredTime, position = Vector3.zero, rotation = Quaternion.identity }); } }
public void Close() { var finalPose = buffer.GetLatest(); for (int i = 0; i < buffer.Count - 1; i++) { Receive(finalPose); } OnClose(); }
public void Close() { var finalPose = buffer.GetLatest(); if (Application.isPlaying) { for (int i = 0; i < buffer.Count - 1; i++) { Receive(finalPose); } } else { // Just pass-through if we're getting a value at edit-time. OnSend(finalPose); } OnClose(); }
// TODO: DELETEME //private void drawBeginPressVolume(RuntimeGizmoDrawer drawer) { // drawer.color = LeapColor.lime.Lerp(Color.white, 0.3f); // entryVolume.DrawRuntimeGizmos(drawer); //} private void drawLatestKnownInteractingSphere(RuntimeGizmoDrawer drawer) { drawer.color = LeapColor.lime; if (!_wasMotionIntersectingBuffer.IsEmpty) { if (_wasMotionIntersectingBuffer.GetLatest()) { drawer.color = LeapColor.coral; } } if (_interactorPos.HasValue) { new Sphere(_interactorPos.Value, _interactorRadius).DrawRuntimeGizmos(drawer); } if (_lastInteractorPos.HasValue) { new Sphere(_lastInteractorPos.Value, _interactorRadius).DrawRuntimeGizmos(drawer); } }