Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TwoHandManipulatable updates from Dev #2435

Merged
merged 2 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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