Skip to content

Commit 922ec61

Browse files
author
David Kline
authored
Merge pull request #2937 from keveleigh/CameraSolverFlipRevert
Prevent solver targets from rotating when the target is the head
2 parents f42dce7 + dfde4f8 commit 922ec61

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Assets/HoloToolkit-Examples/Utilities/Scenes/SolverExamples.unity

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,11 @@ Prefab:
17001700
propertyPath: hideThisObject
17011701
value:
17021702
objectReference: {fileID: 37845493}
1703+
- target: {fileID: 114459743357777030, guid: 687094229f7a92743bd68e3e190259ae,
1704+
type: 2}
1705+
propertyPath: updateSolverTargetToClickSource
1706+
value: 0
1707+
objectReference: {fileID: 0}
17031708
m_RemovedComponents: []
17041709
m_ParentPrefab: {fileID: 100100000, guid: 687094229f7a92743bd68e3e190259ae, type: 2}
17051710
m_IsPrefabParent: 0

Assets/HoloToolkit/Utilities/Scripts/Editor/SolverHandlerEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public override void OnInspectorGUI()
5050

5151
serializedObject.ApplyModifiedProperties();
5252

53-
if (trackedObjectChanged)
53+
if (Application.isPlaying && trackedObjectChanged)
5454
{
5555
solverHandler.TransformTarget = null;
5656
solverHandler.AttachToNewTrackedObject();
5757
}
5858

59-
if (additionalOffsetChanged)
59+
if (Application.isPlaying && additionalOffsetChanged)
6060
{
6161
solverHandler.AdditionalOffset = additionalOffsetProperty.vector3Value;
6262
solverHandler.AdditionalRotation = additionalRotationProperty.vector3Value;

Assets/HoloToolkit/Utilities/Scripts/Solvers/SolverHandler.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,12 @@ private Transform MakeOffsetTransform(Transform parentTransform)
216216
transformWithOffset.transform.localPosition = AdditionalOffset;
217217
transformWithOffset.transform.localRotation = Quaternion.Euler(AdditionalRotation);
218218
transformWithOffset.name = string.Format("{0} on {1} with offset {2}, {3}", gameObject.name, TrackedObjectToReference.ToString(), AdditionalOffset, AdditionalRotation);
219-
// In order to account for the reversed normals due to the glTF coordinate system change, we need to provide rotated attachment points.
220-
transformWithOffset.transform.Rotate(0, 180, 0);
219+
220+
if (TrackedObjectToReference != TrackedObjectToReferenceEnum.Head)
221+
{
222+
// In order to account for the reversed normals due to the glTF coordinate system change, we need to provide rotated attachment points.
223+
transformWithOffset.transform.Rotate(0, 180, 0);
224+
}
221225

222226
return transformWithOffset.transform;
223227
}

0 commit comments

Comments
 (0)