Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Visualisation fix for #233 (#234)
Browse files Browse the repository at this point in the history
* Initial check-in of Visualisation fix for #233

* Reordered the visualisation logic.
Included global pointer parameter

* Updated Default mapping definitions for Touch, resolves pointer issue as Press interactions were mapped to Axis instead of button

* Update spelling and restructure elements

* Minor mapping change after review

* Updated Mapping layout

* Review comments addressed
  • Loading branch information
SimonDarksideJ authored Jul 11, 2019
1 parent 5a1915b commit 0401b85
Show file tree
Hide file tree
Showing 6 changed files with 285 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ public bool UseDefaultModels
}

[SerializeField]
[Tooltip("Override Left Controller Model.")]
[Tooltip("Default Left Controller Model.\nNote: If an override profile model is not found for a specific controller, the fallback is the global model for the specific hand.")]
private GameObject globalLeftHandModel;

/// <summary>
/// The Default controller model when there is no specific controller model for the Left hand or when no hand is specified (Handedness = none)
/// The Default controller model, for when there is no specific controller model for the Left hand or when no hand is specified (Handedness = none)
/// </summary>
/// <remarks>
/// If the default model for the left hand controller can not be found, the controller will fall back and use this for visualization.
/// If the default model for the left hand controller can not be found, the controller will fall back and use this setting for visualization.
/// </remarks>
public GameObject GlobalLeftHandModel
{
Expand All @@ -71,20 +71,39 @@ public GameObject GlobalLeftHandModel
}

[SerializeField]
[Tooltip("Override Right Controller Model.\nNote: If the default model is not found, the fallback is the global right hand model.")]
[Tooltip("Default Right Controller Model.\nNote: If an override profile model is not found for a specific controller, the fallback is the global model for the specific hand.")]
private GameObject globalRightHandModel;

/// <summary>
/// The Default controller model when there is no specific controller model for the Right hand.
/// The Default controller pose action, for when there is no specific pose for specific controller / hand combination.
/// </summary>
/// <remarks>
/// If the default model for the right hand controller can not be found, the controller will fall back and use this for visualization.
/// If the default model for the right hand controller can not be found, the controller will fall back and use this setting for visualization.
/// </remarks>
public GameObject GlobalRightHandModel
{
get => globalRightHandModel;
private set => globalRightHandModel = value;
}

[SerializeField]
[Tooltip("Default Pose Action.\nNote: If an override profile is not found for a specific controller, the default pose action is used.")]
private MixedRealityInputAction globalPointerPose;

/// <summary>
/// The Default controller model, for when there is no specific controller model for the Left hand or when no hand is specified (Handedness = none)
/// </summary>
/// <remarks>
/// If the pointer pose action for the specific controller can not be found, the controller will fall back and use this setting for visualization.
/// </remarks>
/// <remarks>
/// If the default model for the right hand controller can not be found, the controller will fall back and use this setting for visualization.
/// </remarks>
public MixedRealityInputAction GlobalPointerPose
{
get => globalPointerPose;
private set => globalPointerPose = value;
}

[SerializeField]
private MixedRealityControllerVisualizationSetting[] controllerVisualizationSettings = new MixedRealityControllerVisualizationSetting[0];
Expand All @@ -99,20 +118,23 @@ public GameObject GlobalRightHandModel
/// </summary>
/// <param name="controllerType">The type of controller to query for</param>
/// <param name="hand">The specific hand assigned to the controller</param>
public GameObject GetControllerModelOverride(Type controllerType, Handedness hand)
/// <param name="overrideModel">Outputs the supplied model for an overridden visualization (if available), can return null </param>
/// <returns>Returns whether the override visualization should use the System model (if available) or not</returns>
public bool GetControllerModelOverride(Type controllerType, Handedness hand, out GameObject overrideModel)
{
overrideModel = null;

for (int i = 0; i < controllerVisualizationSettings.Length; i++)
{
if (!controllerVisualizationSettings[i].UseDefaultModel &&
controllerVisualizationSettings[i].ControllerType != null &&
if (controllerVisualizationSettings[i].ControllerType != null &&
controllerVisualizationSettings[i].ControllerType.Type == controllerType &&
(controllerVisualizationSettings[i].Handedness == hand || controllerVisualizationSettings[i].Handedness == Handedness.Both))
{
return controllerVisualizationSettings[i].OverrideControllerModel;
overrideModel = controllerVisualizationSettings[i].OverrideControllerModel;
return controllerVisualizationSettings[i].UseDefaultModel;
}
}

return null;
return false;
}

/// <summary>
Expand Down
Loading

0 comments on commit 0401b85

Please sign in to comment.