void OnDrawGizmos() { //loop recordings foreach (ColoredRecording coloredRec in recordings) { Recording recording = coloredRec.recording; if (recording == null) { continue; } //draw colored recording HeadData lastHeadData = null; foreach (DataFrame frame in recording.DataFrames) { HeadData headData = frame.ParseFromJson <HeadData>(); //draw head Gizmos.color = coloredRec.color; headData.DebugDraw(radius, rayLength); //draw connection between heads if (lastHeadData != null) { SetGizmoAlpha(connectionAlpha); Gizmos.DrawLine(lastHeadData.worldPos, headData.worldPos); } lastHeadData = headData; } } }
public void ProcessData(IDataFrame frame) { DataFrame jsonFrame = frame as DataFrame; headData = jsonFrame.ParseFromJson <HeadData>(); if (playbackTarget != null) { Transform parent = playbackTarget.parent; Vector3 headOffset = playbackTarget.position - parent.position; parent.position = headData.worldPos - headOffset; parent.rotation = Quaternion.LookRotation(headData.forward); } }
void Update() { if (!recorder.IsRecording) { return; } if (headTransform == null) { Debug.LogWarning("No transform target set!"); return; } HeadData headData = new HeadData(headTransform); recorder.RecordAsJson(headData); }