public void TakeSnapshot(string snapshotName) { if (!enabled) { return; } Log(snapshotName); var pluginJSON = new JSONClass(); context.embody.StoreJSON(pluginJSON, true, true); pluginJSON.Remove(storeId); snapshots.Add(new EmbodyDebugSnapshot { name = $"{Time.realtimeSinceStartup:0.00} {snapshotName}", vrMode = GetVRMode(), worldScale = SuperController.singleton.worldScale, playerHeightAdjust = SuperController.singleton.playerHeightAdjust, pluginJSON = pluginJSON, poseJSON = StorePoseJSON(), navigationRig = EmbodyTransformDebugSnapshot.From(SuperController.singleton.navigationRig), head = EmbodyTransformDebugSnapshot.From(context.head), leftHand = EmbodyTransformDebugSnapshot.From(context.LeftHand()), rightHand = EmbodyTransformDebugSnapshot.From(context.RightHand()), viveTracker1 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker1), viveTracker2 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker2), viveTracker3 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker3), viveTracker4 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker4), viveTracker5 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker5), viveTracker6 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker6), viveTracker7 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker7), viveTracker8 = EmbodyTransformDebugSnapshot.From(SuperController.singleton.viveTracker8), }); }
public static EmbodyDebugSnapshot FromJSON(JSONClass jc) { return(new EmbodyDebugSnapshot { name = jc.HasKey("Name") ? jc["Name"].Value : null, active = jc.HasKey("Active") && jc["Active"].Value != "Null" ? jc["Active"].AsBool : (bool?)null, vrMode = jc.HasKey("VRMode") ? jc["VRMode"].Value : null, worldScale = jc.HasKey("WorldScale") ? jc["WorldScale"].AsFloat : 0f, playerHeightAdjust = jc.HasKey("PlayerHeightAdjust") ? jc["PlayerHeightAdjust"].AsFloat : 0f, navigationRig = jc.HasKey("NavigationRig") ? EmbodyTransformDebugSnapshot.FromJSON(jc["NavigationRig"]) : null, head = jc.HasKey("Head") ? EmbodyTransformDebugSnapshot.FromJSON(jc["Head"]) : null, leftHand = jc.HasKey("LeftHand") ? EmbodyTransformDebugSnapshot.FromJSON(jc["LeftHand"]) : null, rightHand = jc.HasKey("RightHand") ? EmbodyTransformDebugSnapshot.FromJSON(jc["RightHand"]) : null, viveTracker1 = jc.HasKey("ViveTracker1") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker1"]) : null, viveTracker2 = jc.HasKey("ViveTracker2") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker2"]) : null, viveTracker3 = jc.HasKey("ViveTracker3") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker3"]) : null, viveTracker4 = jc.HasKey("ViveTracker4") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker4"]) : null, viveTracker5 = jc.HasKey("ViveTracker5") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker5"]) : null, viveTracker6 = jc.HasKey("ViveTracker6") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker6"]) : null, viveTracker7 = jc.HasKey("ViveTracker7") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker7"]) : null, viveTracker8 = jc.HasKey("ViveTracker8") ? EmbodyTransformDebugSnapshot.FromJSON(jc["ViveTracker8"]) : null, pluginJSON = jc.HasKey("Plugin") ? jc["Plugin"].AsObject : null, poseJSON = jc.HasKey("Pose") ? jc["Pose"].AsArray : null }); }
private static Transform CreateFakeTrackers(string suffix, EmbodyTransformDebugSnapshot snapshot) { if (snapshot == null) { return(null); } var go = new GameObject(_embodyDebugPrefix + suffix); go.transform.SetParent(SuperController.singleton.worldScaleTransform, false); go.transform.position = snapshot.position; go.transform.eulerAngles = snapshot.rotation; VisualCuesHelper.Cross(Color.white).transform.SetParent(go.transform, false); return(go.transform); }