// Update is called once per frame void Update() { #if UNITY_EDITOR var activateGameObject = UnityEditor.Selection.activeGameObject; if (activateGameObject) { if (activateGameObject.activeInHierarchy) { var agent = UnityEditor.Selection.activeGameObject.GetComponentInChildren <ProfileController>(); if (agent) { GraphOverlay.Plot("Curvature", agent.curvature); GraphOverlay.Plot("Camber", agent.camber); GraphOverlay.Plot("Inclination", agent.inclination); } } } #endif }
void Update() { #if UNITY_EDITOR var activateGameObject = UnityEditor.Selection.activeGameObject; if (activateGameObject) { if (activateGameObject.activeInHierarchy) { var pathFinder = UnityEditor.Selection.activeGameObject.GetComponentInChildren <ProfileAgent>(); if (pathFinder) { GraphOverlay.Plot("Profile", pathFinder.profile.Select(x => x.speed)); GraphOverlay.Plot("Speed", pathFinder.profile.Select(x => x.actual)); GraphOverlay.Plot("Traction", pathFinder.profile.Select(x => x.traction ? 1f : 0f)); GraphOverlay.Plot("Error", pathFinder.profile.Select(x => x.error)); GraphOverlay.Plot("Drift", pathFinder.profile.Select(x => x.sideslip)); GraphOverlay.Cursor(pathFinder.currentNode); } } } #endif }
private void FixedUpdate() { var activateGameObject = UnityEditor.Selection.activeGameObject; if (activateGameObject) { if (activateGameObject.activeInHierarchy) { var navigator = UnityEditor.Selection.activeGameObject.GetComponent <PathNavigator>(); if (navigator) { if (Curvature.Length != numObservations) { Curvature = new float[numObservations]; Camber = new float[numObservations]; Inclination = new float[numObservations]; Distance = new float[numObservations]; } for (int i = 0; i < numObservations; i++) { var d = navigator.Distance + i * pathInterval; var q = navigator.waypoints.Query(d); Camber[i] = q.Camber; Curvature[i] = q.Curvature; Inclination[i] = q.Inclination; Distance[i] = d; } GraphOverlay.Plot("Curvature", Curvature); GraphOverlay.Plot("Camber", Camber); GraphOverlay.Plot("Inclination", Inclination); } } } }