Skip to content

Commit

Permalink
Merge pull request #2435 from keveleigh/TwoHandManipulatable
Browse files Browse the repository at this point in the history
TwoHandManipulatable updates from Dev
  • Loading branch information
StephenHodgson authored Jul 12, 2018
2 parents f05bb6d + abbefd8 commit d874b25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;

namespace HoloToolkit.Unity.InputModule.Utilities.Interactions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using UnityEngine;
using UnityEngine.Assertions;


namespace HoloToolkit.Unity.InputModule.Utilities.Interactions
{
/// <summary>
Expand All @@ -30,23 +29,16 @@ public Transform HostTransform
}

[SerializeField]
[Tooltip("To visualize the object bounding box, drop the HoloToolKit/UX/Prefabs/BoundingBoxes/BoundingBoxBasic.prefab here. This is optional.")]
[Tooltip("To visualize the object bounding box, drop the HoloToolkit/UX/Prefabs/BoundingBoxes/BoundingBoxBasic.prefab here. This is optional.")]
private BoundingBox boundingBoxPrefab = null;

/// <summary>
/// Reference to the Prefab from which clone is instantiated.
/// </summary>
public BoundingBox BoundingBoxPrefab
{
set
{
boundingBoxPrefab = value;
}

get
{
return boundingBoxPrefab;
}
set { boundingBoxPrefab = value; }
get { return boundingBoxPrefab; }
}

[SerializeField]
Expand Down Expand Up @@ -79,7 +71,7 @@ public bool EnableEnableOneHandedMovement
set { enableOneHandMovement = value; }
}

// private fields that store transform information.
// Private fields that store transform information.
#region Transform Info

private BoundingBox boundingBoxInstance;
Expand All @@ -91,7 +83,7 @@ public bool EnableEnableOneHandedMovement
#endregion Transform Info

/// <summary>
/// Maps input id -> position of hand
/// Maps input id -> position of hand.
/// </summary>
private readonly Dictionary<uint, Vector3> handsPressedLocationsMap = new Dictionary<uint, Vector3>();

Expand All @@ -117,7 +109,7 @@ private bool ShowBoundingBox

if (value)
{
boundingBoxInstance.Target = gameObject;
boundingBoxInstance.Target = HostTransform.gameObject;
boundingBoxInstance.gameObject.SetActive(true);
}
else
Expand All @@ -130,17 +122,14 @@ private bool ShowBoundingBox
}

/// <summary>
/// SetManipulationMode
/// Change the manipulation mode.
/// </summary>
[System.Obsolete("Use ManipulationMode")]
[System.Obsolete("Use ManipulationMode.")]
public void SetManipulationMode(ManipulationMode mode)
{
manipulationMode = mode;
}

/// <summary>
/// Private Methods
/// </summary>
private void Awake()
{
moveLogic = new TwoHandMoveLogic();
Expand All @@ -158,7 +147,7 @@ private void Start()

private void Update()
{
//Update positions of all hands
// Update positions of all hands
foreach (var key in handsPressedInputSourceMap.Keys)
{
var inputSource = handsPressedInputSourceMap[key];
Expand Down Expand Up @@ -196,7 +185,7 @@ private void RemoveSourceIdFromHandMap(uint sourceId)
}

/// <summary>
/// /// Event Handler receives input from inputSource
/// Event Handler receives input from inputSource.
/// </summary>
public void OnInputDown(InputEventData eventData)
{
Expand All @@ -208,7 +197,7 @@ public void OnInputDown(InputEventData eventData)
}

/// <summary>
/// Event Handler receives input from inputSource
/// Event Handler receives input from inputSource.
/// </summary>
public void OnInputUp(InputEventData eventData)
{
Expand All @@ -218,12 +207,12 @@ public void OnInputUp(InputEventData eventData)
}

/// <summary>
/// OnSourceDetected Event Handler
/// OnSourceDetected Event Handler.
/// </summary>
public void OnSourceDetected(SourceStateEventData eventData) { }

/// <summary>
/// OnSourceLost
/// OnSourceLost Event Handler.
/// </summary>
public void OnSourceLost(SourceStateEventData eventData)
{
Expand All @@ -233,7 +222,7 @@ public void OnSourceLost(SourceStateEventData eventData)
}

/// <summary>
/// private Event Handlers
/// Updates the state machine based on the current state and anything that might have changed with the hands.
/// </summary>
private void UpdateStateMachine()
{
Expand Down Expand Up @@ -418,15 +407,15 @@ private void OnManipulationStarted()
{
InputManager.Instance.PushModalInputHandler(gameObject);

//Show Bounding Box visual on manipulation interaction
// Show Bounding Box visual on manipulation interaction
ShowBoundingBox = true;
}

private void OnManipulationEnded()
{
InputManager.Instance.PopModalInputHandler();

//Hide Bounding Box visual on release
// Hide Bounding Box visual on release
ShowBoundingBox = false;
}
}
Expand Down

0 comments on commit d874b25

Please sign in to comment.