Skip to content

Commit 34ff992

Browse files
committed
feat: adding an original transform to track when custom transforms are in use
1 parent f6cf26d commit 34ff992

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

Assets/Scripts/Core/CoordinateSystems/CoordinateSpaceManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
public class CoordinateSpaceManager : MonoBehaviour
77
{
8+
/// <summary>
9+
/// Stores the original transform, when the active transform is a custom transform
10+
/// </summary>
11+
public static CoordinateTransform OriginalTransform;
12+
813
public static CoordinateSpace ActiveCoordinateSpace;
914
public static CoordinateTransform ActiveCoordinateTransform;
1015
public static CoordinateSpaceManager Instance;

Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,11 @@ public static ProbeData ProbeManager2ProbeData(ProbeManager probeManager)
932932
data.Angles = probeManager.ProbeController.Insertion.angles;
933933

934934
data.CoordSpaceName = probeManager.ProbeController.Insertion.CoordinateSpace.Name;
935-
data.CoordTransformName = probeManager.ProbeController.Insertion.CoordinateTransform.Name;
935+
936+
if (probeManager.ProbeController.Insertion.CoordinateTransform.Name.Equals("Custom"))
937+
data.CoordTransformName = CoordinateSpaceManager.OriginalTransform.Name;
938+
else
939+
data.CoordTransformName = probeManager.ProbeController.Insertion.CoordinateTransform.Name;
936940

937941
data.SelectionLayerName = probeManager.SelectionLayerName;
938942

Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -914,19 +914,19 @@ private void LoadSavedProbesFromStringArray(string[] savedProbes)
914914
CoordinateTransform probeOrigTransform = coordinateTransformOpts[probeData.CoordTransformName];
915915

916916
ProbeInsertion probeInsertion;
917-
//if (probeOrigTransform.Name != CoordinateSpaceManager.ActiveCoordinateTransform.Name)
918-
//{
919-
// Debug.LogError($"[TODO] Need to warn user when transforming a probe into the active coordinate space!!");
920-
// Vector3 newAPMLDV = CoordinateSpaceManager.ActiveCoordinateTransform.Space2Transform(probeOrigTransform.Transform2Space(probeData.APMLDV));
921-
922-
// probeInsertion = new ProbeInsertion(newAPMLDV, probeData.Angles,
923-
// CoordinateSpaceManager.ActiveCoordinateSpace, CoordinateSpaceManager.ActiveCoordinateTransform);
924-
//}
925-
//else
926-
//{
917+
if (probeOrigTransform.Name != CoordinateSpaceManager.ActiveCoordinateTransform.Name)
918+
{
919+
Debug.LogError($"[TODO] Need to warn user when transforming a probe into the active coordinate space!!");
920+
Vector3 newAPMLDV = CoordinateSpaceManager.ActiveCoordinateTransform.Space2Transform(probeOrigTransform.Transform2Space(probeData.APMLDV));
921+
922+
probeInsertion = new ProbeInsertion(newAPMLDV, probeData.Angles,
923+
CoordinateSpaceManager.ActiveCoordinateSpace, CoordinateSpaceManager.ActiveCoordinateTransform);
924+
}
925+
else
926+
{
927927
probeInsertion = new ProbeInsertion(probeData.APMLDV, probeData.Angles,
928928
CoordinateSpaceManager.ActiveCoordinateSpace, CoordinateSpaceManager.ActiveCoordinateTransform);
929-
//}
929+
}
930930

931931

932932
ProbeManager newProbeManager = AddNewProbe((ProbeProperties.ProbeType)probeData.Type, probeInsertion,

0 commit comments

Comments
 (0)