Skip to content

Commit 56b9a6e

Browse files
committed
Add comments and summary tags
1 parent c8e5efd commit 56b9a6e

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Assets/HoloToolkit/Input/Scripts/Cursor/Cursor.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,18 @@ public IPointingSource Pointer
2525
get { return pointer; }
2626
set
2727
{
28+
// This value is used to determine the cursor's default distance.
29+
// It is cached here to prevent repeated casting in the update loop.
2830
pointerIsInputSourcePointer = value is InputSourcePointer;
2931
pointer = value;
3032
}
3133
}
32-
3334
private IPointingSource pointer;
3435

36+
/// <summary>
37+
/// Cached value if the pointer is of type InputSourcePointer,
38+
/// to prevent repeated casting in the update loop.
39+
/// </summary>
3540
private bool pointerIsInputSourcePointer = false;
3641

3742
/// <summary>
@@ -122,6 +127,10 @@ public Vector3 LocalScale
122127
private Vector3 targetScale;
123128
private Quaternion targetRotation;
124129

130+
/// <summary>
131+
/// Keeps track of the starting setting for DefaultCursorDistance,
132+
/// to revert after a pointer overrides the value.
133+
/// </summary>
125134
private float originalDefaultCursorDistance;
126135

127136
/// <summary>

Assets/HoloToolkit/Input/Scripts/Focus/SimpleSinglePointerSelector.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,16 +305,19 @@ private void AttachInputSourcePointer(IInputSource inputSource, uint sourceId)
305305

306306
InteractionInputSource interactionInputSource = inputSource as InteractionInputSource;
307307

308+
// If the InputSource is not an InteractionInputSource, we don't display any ray visualizations.
308309
if (interactionInputSource == null)
309310
{
310311
return;
311312
}
312313

314+
// If no pointing ray prefab has been provided, we return early as there's nothing to display.
313315
if (linePointerPrefab == null)
314316
{
315317
return;
316318
}
317319

320+
// If the pointer line hasn't already been instantiated, create it and store it here.
318321
if (instantiatedPointerLine == null)
319322
{
320323
instantiatedPointerLine = Instantiate(linePointerPrefab).GetComponent<PointerLine>();
@@ -326,6 +329,7 @@ private void AttachInputSourcePointer(IInputSource inputSource, uint sourceId)
326329
if (interactionInputSource.TryGetHandedness(sourceId, out handedness))
327330
{
328331
#if UNITY_WSA && UNITY_2017_2_OR_NEWER
332+
// This updates the handedness of the pointer line, allowing for re-use if it was already in the scene.
329333
instantiatedPointerLine.ChangeHandedness((InteractionSourceHandedness)handedness);
330334
#endif
331335
}

Assets/HoloToolkit/Input/Scripts/Utilities/ControllerFinder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ protected virtual void OnDestroy()
9090
#endif
9191
}
9292

93+
/// <summary>
94+
/// Allows the object to change which controller it tracks, based on handedness.
95+
/// </summary>
96+
/// <param name="newHandedness">The new handedness to track. Does nothing if the handedness doesn't change.</param>
9397
#if UNITY_WSA && UNITY_2017_2_OR_NEWER
9498
public void ChangeHandedness(InteractionSourceHandedness newHandedness)
9599
{

0 commit comments

Comments
 (0)