static void SetSnapshot(DynamicObjectSnapshot snap, StringBuilder builder) { builder.Append('{'); JsonUtil.SetString("id", snap.Id, builder); builder.Append(','); JsonUtil.SetDouble("time", snap.Timestamp, builder); builder.Append(','); JsonUtil.SetVectorRaw("p", snap.posX, snap.posY, snap.posZ, builder); builder.Append(','); JsonUtil.SetQuatRaw("r", snap.rotX, snap.rotY, snap.rotZ, snap.rotW, builder); if (snap.DirtyScale) { builder.Append(','); JsonUtil.SetVectorRaw("s", snap.scaleX, snap.scaleY, snap.scaleZ, builder); } //properties should already be formatted, just need to append them here if (!string.IsNullOrEmpty(snap.Properties)) { //properties are an array of a single object? weird builder.Append(",\"properties\":[{"); builder.Append(snap.Properties); builder.Append("}]"); } if (!string.IsNullOrEmpty(snap.Buttons)) { builder.Append(",\"buttons\":{"); builder.Append(snap.Buttons); builder.Append("}"); } builder.Append("}"); //close object snapshot }