Finishing AttachToController refactoring, especially BrushSelector

This commit is contained in:
Kurtis Eveleigh 2017-11-10 13:18:14 -08:00
Родитель 2ae49253fe
Коммит 31af5cf719
13 изменённых файлов: 266 добавлений и 271 удалений

Просмотреть файл

@ -256,6 +256,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2241eb5c410180c4dbd2a53787deb25d, type: 3}
m_Name:
m_EditorClassIdentifier:
handedness: 2
element: 6
SetChildrenInactiveWhenDetached: 1
positionOffset: {x: 0, y: 0, z: 0}
rotationOffset: {x: 0, y: 0, z: 0}
scale: {x: 1, y: 1, z: 1}
setScaleOnAttach: 0
brushCollection: {fileID: 114412594797402372}
currentAction: 0
swipeCurve:
@ -317,8 +324,6 @@ MonoBehaviour:
activeBrushindex: 3
colorPicker: {fileID: 0}
menuTimeout: 2
handedness: 2
element: 6
touchpadMaterial: {fileID: 2100000, guid: 9ab2a9ffd08a18a4b897b448b582c956, type: 2}
touchpadColor:
serializedVersion: 2

Просмотреть файл

@ -286,8 +286,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c867040d80ee6c54ba5482735391537d, type: 3}
m_Name:
m_EditorClassIdentifier:
Handedness: 1
handedness: 1
element: 5
SetChildrenInactiveWhenDetached: 1
positionOffset: {x: 0, y: 0, z: 0}
rotationOffset: {x: 0, y: 0, z: 0}
scale: {x: 1, y: 1, z: 1}
@ -295,7 +296,6 @@ MonoBehaviour:
visible: 1
selectorTransform: {fileID: 4679133003569798}
inputScale: 1.1
selectorPosition: {x: 0, y: 0}
selectedColor: {r: 1, g: 1, b: 1, a: 1}
colorWheelTexture: {fileID: 2800000, guid: e7bc94dceceb4ec4fbb4c9ada0caebd5, type: 3}
colorWheelObject: {fileID: 1580881552183484}

Просмотреть файл

@ -21,7 +21,6 @@ GameObject:
- component: {fileID: 4032885844940304}
- component: {fileID: 114221813441956770}
- component: {fileID: 114252619641230810}
- component: {fileID: 114154045772793958}
- component: {fileID: 114668976894459158}
- component: {fileID: 114811848714529564}
m_Layer: 0
@ -44,23 +43,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114154045772793958
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1836252858122320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 925239cfb24ed9a47adb987a482c572c, type: 3}
m_Name:
m_EditorClassIdentifier:
positionOffset: {x: 0, y: 0, z: 0}
rotationOffset: {x: 0, y: 0, z: 0}
setScaleOnAttach: 0
scale: {x: 1, y: 1, z: 1}
handedness: 2
element: 0
--- !u!114 &114221813441956770
MonoBehaviour:
m_ObjectHideFlags: 1
@ -212,9 +194,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d3cd01478dcfed14990ee756229ca04f, type: 3}
m_Name:
m_EditorClassIdentifier:
handedness: 2
element: 6
SetChildrenInactiveWhenDetached: 0
positionOffset: {x: 0, y: 0, z: 0}
rotationOffset: {x: 0, y: 0, z: 0}
scale: {x: 1, y: 1, z: 1}
setScaleOnAttach: 0
pointer: {fileID: 114221813441956770}
activePressType: 3
handedness: 2
--- !u!114 &114668976894459158
MonoBehaviour:
m_ObjectHideFlags: 1

Просмотреть файл

@ -286,8 +286,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 393789416249a224f963f1f8daf39cdc, type: 3}
m_Name:
m_EditorClassIdentifier:
Handedness: 1
handedness: 1
element: 6
SetChildrenInactiveWhenDetached: 1
positionOffset: {x: 0, y: 0, z: 0}
rotationOffset: {x: 0, y: 0, z: 0}
scale: {x: 1, y: 1, z: 1}

Просмотреть файл

@ -11,14 +11,17 @@ namespace HoloToolkit.Unity.Controllers
/// <summary>
/// Waits for a controller to be instantiated, then attaches itself to a specified element
/// </summary>
public class AttachToController : MonoBehaviour
public abstract class AttachToController : MonoBehaviour
{
[Header("AttachToController Elements")]
[SerializeField]
protected InteractionSourceHandedness handedness = InteractionSourceHandedness.Left;
[SerializeField]
protected MotionControllerInfo.ControllerElementEnum element = MotionControllerInfo.ControllerElementEnum.PointingPose;
public bool SetChildrenInactiveWhenDetached = true;
[SerializeField]
protected Vector3 positionOffset = Vector3.zero;
@ -33,18 +36,18 @@ namespace HoloToolkit.Unity.Controllers
public bool IsAttached { get; private set; }
public Transform Element { get { return elementTransform; } }
private MotionControllerInfo controller;
public MotionControllerInfo Controller { get { return controller; } }
public event Action<MotionControllerInfo> OnAttachToController;
public event Action<MotionControllerInfo> OnDetachFromController;
private Transform elementTransform;
public Transform ElementTransform { get; private set; }
private void OnEnable()
protected MotionControllerInfo controller;
protected abstract void OnAttachToController();
protected abstract void OnDetachFromController();
protected virtual void OnEnable()
{
SetChildrenActive(false);
// Look if the controller has loaded.
if (MotionControllerVisualizer.Instance.TryGetControllerModel(handedness, out controller))
{
@ -55,7 +58,7 @@ namespace HoloToolkit.Unity.Controllers
MotionControllerVisualizer.Instance.OnControllerModelUnloaded += DetachElementFromController;
}
private void OnDisable()
protected virtual void OnDisable()
{
if (MotionControllerVisualizer.IsInitialized)
{
@ -64,7 +67,7 @@ namespace HoloToolkit.Unity.Controllers
}
}
private void OnDestroy()
protected virtual void OnDestroy()
{
if (MotionControllerVisualizer.IsInitialized)
{
@ -73,16 +76,20 @@ namespace HoloToolkit.Unity.Controllers
}
}
private void AttachElementToController(MotionControllerInfo controller)
private void AttachElementToController(MotionControllerInfo newController)
{
if (!IsAttached)
if (!IsAttached && newController.Handedness == handedness)
{
if (!controller.TryGetElement(element, out elementTransform))
if (!newController.TryGetElement(element, out elementTransform))
{
Debug.LogError("Unable to find element of type " + element + " under controller " + controller.ControllerParent.name + "; not attaching.");
Debug.LogError("Unable to find element of type " + element + " under controller " + newController.ControllerParent.name + "; not attaching.");
return;
}
controller = newController;
SetChildrenActive(true);
// Parent ourselves under the element and set our offsets
transform.parent = elementTransform;
transform.localPosition = positionOffset;
@ -93,27 +100,36 @@ namespace HoloToolkit.Unity.Controllers
}
// Announce that we're attached
if (OnAttachToController != null)
{
OnAttachToController(controller);
}
OnAttachToController();
IsAttached = true;
}
else
}
private void DetachElementFromController(MotionControllerInfo oldController)
{
if (IsAttached && oldController.Handedness == handedness)
{
Debug.Log(name + " is already attached.");
OnDetachFromController();
controller = null;
transform.parent = null;
SetChildrenActive(false);
IsAttached = false;
}
}
private void DetachElementFromController(MotionControllerInfo e)
private void SetChildrenActive(bool isActive)
{
if (OnDetachFromController != null)
if (SetChildrenInactiveWhenDetached)
{
OnDetachFromController(e);
foreach (Transform child in transform)
{
child.gameObject.SetActive(isActive);
}
}
IsAttached = false;
}
}
}

Просмотреть файл

@ -10,8 +10,7 @@ using UnityEngine.XR.WSA.Input;
namespace HoloToolkit.Unity.ControllerExamples
{
[RequireComponent(typeof(AttachToController))]
public class BrushSelector : MonoBehaviour
public class BrushSelector : AttachToController
{
public enum SwipeEnum
{
@ -37,12 +36,6 @@ namespace HoloToolkit.Unity.ControllerExamples
[SerializeField]
private float menuTimeout = 2f;
[SerializeField]
private InteractionSourceHandedness handedness = InteractionSourceHandedness.Right;
[SerializeField]
private MotionControllerInfo.ControllerElementEnum element = MotionControllerInfo.ControllerElementEnum.PointingPose;
private MotionControllerInfo controller;
[SerializeField]
private Material touchpadMaterial;
[SerializeField]
@ -54,12 +47,26 @@ namespace HoloToolkit.Unity.ControllerExamples
private float menuOpenTime = 0f;
private bool menuOpen = false;
private bool switchingBrush = false;
private float startOffset;
private float targetOffset;
private float startTime;
private bool resetInput;
private Brush activeBrush;
private Material originalTouchpadMaterial;
protected override void OnEnable()
{
base.OnEnable();
displayBrushindex = -1;
currentAction = SwipeEnum.Left;
}
private void Update()
{
if (menuOpen)
@ -75,138 +82,107 @@ namespace HoloToolkit.Unity.ControllerExamples
for (int i = 0; i < brushCollection.Objects.Count; i++)
{
Brush brush = brushCollection.Objects[i].GetComponent<Brush>();
brush.StrokeColor = colorPicker.SelectedColor;
if (brush == activeBrush)
{
brush.DisplayMode = Brush.DisplayModeEnum.InHand;
}
else
{
brush.DisplayMode = menuOpen ? Brush.DisplayModeEnum.InMenu : Brush.DisplayModeEnum.Hidden;
}
}
// Update our touchpad material
Color glowColor = touchpadColor.Evaluate((Time.unscaledTime - touchpadTouchTime) / touchpadGlowLossTime);
touchpadMaterial.SetColor("_EmissionColor", glowColor);
touchpadMaterial.SetColor("_Color", glowColor);
if (!switchingBrush)
{
if (currentAction == SwipeEnum.None)
{
return;
}
if (!menuOpen)
{
menuOpenTime = Time.unscaledTime;
menuOpen = true;
}
// Stop the active brush if we have one
if (activeBrush != null)
{
activeBrush.Draw = false;
activeBrush = null;
}
// Get the current offset and the target offset from our collection
startOffset = brushCollection.GetOffsetFromObjectIndex(displayBrushindex);
targetOffset = startOffset;
switch (currentAction)
{
case SwipeEnum.Right:
displayBrushindex = brushCollection.GetPrevObjectIndex(displayBrushindex);
activeBrushindex = brushCollection.GetNextObjectIndex(activeBrushindex);
targetOffset -= brushCollection.DistributionOffsetPerObject;
break;
case SwipeEnum.Left:
default:
displayBrushindex = brushCollection.GetNextObjectIndex(displayBrushindex);
activeBrushindex = brushCollection.GetPrevObjectIndex(activeBrushindex);
targetOffset += brushCollection.DistributionOffsetPerObject;
break;
}
// Get the current brush from the object list
Transform brushTransform = brushCollection.Objects[activeBrushindex];
activeBrush = brushTransform.GetComponent<Brush>();
// Lerp from current to target offset
startTime = Time.unscaledTime;
resetInput = false;
switchingBrush = true;
}
else
{
if (Time.unscaledTime < startTime + swipeDuration)
{
float normalizedTime = (Time.unscaledTime - startTime) / swipeDuration;
if (!resetInput && normalizedTime > 0.5f)
{
// If we're past the halfway point, set our swipe action to none
// If the user swipes again before we're done switching, we'll move to the next item
resetInput = true;
currentAction = SwipeEnum.None;
}
brushCollection.DistributionOffset = Mathf.Lerp(startOffset, targetOffset, swipeCurve.Evaluate(normalizedTime));
menuOpenTime = Time.unscaledTime;
}
else
{
switchingBrush = false;
brushCollection.DistributionOffset = targetOffset;
}
}
}
}
private IEnumerator Start()
protected override void OnDestroy()
{
while (!MotionControllerVisualizer.Instance.TryGetControllerModel(handedness, out controller))
{
menuOpen = false;
yield return null;
}
base.OnDestroy();
// Parent the brush tools under the element of choice
Transform elementTransform;
if (!controller.TryGetElement(element, out elementTransform))
{
Debug.LogError("Element " + element.ToString() + " not found in controller, can't proceed.");
gameObject.SetActive(false);
yield break;
}
transform.parent = elementTransform;
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
// Turn off the default controller's renderers
controller.SetRenderersVisible(false);
// Get the touchpad and assign our custom material to it
Transform touchpad;
if (controller.TryGetElement(MotionControllerInfo.ControllerElementEnum.Touchpad, out touchpad))
{
touchpadRenderer = touchpad.GetComponentInChildren<MeshRenderer>();
touchpadRenderer.material = touchpadMaterial;
touchpadRenderer.enabled = true;
}
// Subscribe to input now that we're parented under the controller
InteractionManager.InteractionSourceUpdated += InteractionSourceUpdated;
InteractionManager.InteractionSourcePressed += InteractionSourcePressed;
InteractionManager.InteractionSourceReleased += InteractionSourceReleased;
while (isActiveAndEnabled)
{
while (currentAction == SwipeEnum.None)
{
foreach (Transform brushObject in brushCollection.Objects)
{
brushObject.GetComponent<Brush>().StrokeColor = colorPicker.SelectedColor;
}
yield return null;
}
if (!menuOpen)
{
menuOpenTime = Time.unscaledTime;
menuOpen = true;
}
// Stop the active brush if we have one
if (activeBrush != null)
{
activeBrush.Draw = false;
activeBrush = null;
}
// Get the current offset and the target offset from our collection
startOffset = brushCollection.GetOffsetFromObjectIndex(displayBrushindex);
targetOffset = startOffset;
switch (currentAction)
{
case SwipeEnum.Right:
displayBrushindex = brushCollection.GetPrevObjectIndex(displayBrushindex);
activeBrushindex = brushCollection.GetNextObjectIndex(activeBrushindex);
targetOffset -= brushCollection.DistributionOffsetPerObject;
break;
case SwipeEnum.Left:
default:
displayBrushindex = brushCollection.GetNextObjectIndex(displayBrushindex);
activeBrushindex = brushCollection.GetPrevObjectIndex(activeBrushindex);
targetOffset += brushCollection.DistributionOffsetPerObject;
break;
}
// Get the current brush from the object list
Transform brushTransform = brushCollection.Objects[activeBrushindex];
activeBrush = brushTransform.GetComponent<Brush>();
// Lerp from current to target offset
float startTime = Time.unscaledTime;
bool resetInput = false;
while (Time.unscaledTime < startTime + swipeDuration)
{
float normalizedTime = (Time.unscaledTime - startTime) / swipeDuration;
if (!resetInput && normalizedTime > 0.5f)
{
// If we're past the halfway point, set our swipe action to none
// If the user swipes again before we're done switching, we'll move to the next item
resetInput = true;
currentAction = SwipeEnum.None;
}
brushCollection.DistributionOffset = Mathf.Lerp(startOffset, targetOffset, swipeCurve.Evaluate(normalizedTime));
menuOpenTime = Time.unscaledTime;
yield return null;
}
brushCollection.DistributionOffset = targetOffset;
yield return null;
}
}
private void OnEnable()
{
displayBrushindex = -1;
currentAction = SwipeEnum.Left;
Destroy(originalTouchpadMaterial);
}
private void InteractionSourcePressed(InteractionSourcePressedEventArgs obj)
{
if (obj.state.source.handedness == handedness && obj.pressType == InteractionSourcePressType.Select)
if (obj.state.source.handedness == handedness && obj.pressType == InteractionSourcePressType.Select && activeBrush != null)
{
activeBrush.Draw = true;
}
@ -236,11 +212,49 @@ namespace HoloToolkit.Unity.ControllerExamples
private void InteractionSourceReleased(InteractionSourceReleasedEventArgs obj)
{
if (obj.state.source.handedness == handedness && obj.pressType == InteractionSourcePressType.Select)
if (obj.state.source.handedness == handedness && obj.pressType == InteractionSourcePressType.Select && activeBrush != null)
{
activeBrush.Draw = false;
}
}
protected override void OnAttachToController()
{
// Turn off the default controller's renderers
controller.SetRenderersVisible(false);
// Get the touchpad and assign our custom material to it
Transform touchpad;
if (controller.TryGetElement(MotionControllerInfo.ControllerElementEnum.Touchpad, out touchpad))
{
touchpadRenderer = touchpad.GetComponentInChildren<MeshRenderer>();
originalTouchpadMaterial = touchpadRenderer.material;
touchpadRenderer.material = touchpadMaterial;
touchpadRenderer.enabled = true;
}
// Subscribe to input now that we're parented under the controller
InteractionManager.InteractionSourceUpdated += InteractionSourceUpdated;
InteractionManager.InteractionSourcePressed += InteractionSourcePressed;
InteractionManager.InteractionSourceReleased += InteractionSourceReleased;
}
protected override void OnDetachFromController()
{
controller.SetRenderersVisible(true);
// Get the touchpad and reassign the original material to it
Transform touchpad;
if (controller.TryGetElement(MotionControllerInfo.ControllerElementEnum.Touchpad, out touchpad))
{
touchpadRenderer = touchpad.GetComponentInChildren<MeshRenderer>();
touchpadRenderer.material = originalTouchpadMaterial;
}
// Unubscribe from input
InteractionManager.InteractionSourceUpdated -= InteractionSourceUpdated;
InteractionManager.InteractionSourcePressed -= InteractionSourcePressed;
InteractionManager.InteractionSourceReleased -= InteractionSourceReleased;
}
#if UNITY_EDITOR
void OnDrawGizmos()

Просмотреть файл

@ -23,12 +23,6 @@ namespace HoloToolkit.Unity.ControllerExamples
}
}
public Vector2 SelectorPosition
{
get { return selectorPosition; }
set { selectorPosition = value; }
}
public Color SelectedColor
{
get { return selectedColor; }
@ -41,8 +35,6 @@ namespace HoloToolkit.Unity.ControllerExamples
[SerializeField]
private float inputScale = 1.1f;
[SerializeField]
private Vector2 selectorPosition;
[SerializeField]
private Color selectedColor = Color.white;
[SerializeField]
private Texture2D colorWheelTexture;
@ -53,20 +45,13 @@ namespace HoloToolkit.Unity.ControllerExamples
[SerializeField]
private float timeout = 2f;
private Vector2 selectorPosition;
private float lastTimeVisible;
private bool visibleLastFrame = false;
private void Awake()
{
OnAttachToController += This_OnAttachToController;
OnDetachFromController += This_OnDetachFromController;
visible = false;
}
private void Update()
{
if (Controller == null)
if (controller == null)
{
return;
}
@ -115,14 +100,16 @@ namespace HoloToolkit.Unity.ControllerExamples
}
}
private void This_OnAttachToController(MotionControllerInfo e)
protected override void OnAttachToController()
{
// Subscribe to input now that we're parented under the controller
InteractionManager.InteractionSourceUpdated += InteractionSourceUpdated;
}
private void This_OnDetachFromController(MotionControllerInfo e)
protected override void OnDetachFromController()
{
Visible = false;
// Unsubscribe from input now that we've detached from the controller
InteractionManager.InteractionSourceUpdated -= InteractionSourceUpdated;
}
@ -139,7 +126,7 @@ namespace HoloToolkit.Unity.ControllerExamples
}
Vector3 localHitPoint = selectorTransform.parent.InverseTransformPoint(source.TargetPoint);
SelectorPosition = new Vector2(localHitPoint.x, localHitPoint.z);
selectorPosition = new Vector2(localHitPoint.x, localHitPoint.z);
}
private void InteractionSourceUpdated(InteractionSourceUpdatedEventArgs obj)
@ -147,7 +134,7 @@ namespace HoloToolkit.Unity.ControllerExamples
if (obj.state.source.handedness == handedness && obj.state.touchpadTouched)
{
Visible = true;
SelectorPosition = obj.state.touchpadPosition;
selectorPosition = obj.state.touchpadPosition;
}
}
}

Просмотреть файл

@ -76,8 +76,7 @@ namespace HoloToolkit.Unity.ControllerExamples
private void Awake()
{
OnAttachToController += This_OnAttachToController;
OnDetachFromController += This_OnDetachFromController;
instantiatedMaterial = new Material(objectMaterial);
}
private void Update()
@ -96,6 +95,13 @@ namespace HoloToolkit.Unity.ControllerExamples
instantiatedMaterial.color = colorSource.SelectedColor;
}
protected override void OnDestroy()
{
base.OnDestroy();
Destroy(instantiatedMaterial);
}
private void SpawnObject()
{
if (state != StateEnum.Idle)
@ -107,11 +113,8 @@ namespace HoloToolkit.Unity.ControllerExamples
StartCoroutine(SpawnOverTime());
}
private void This_OnAttachToController(MotionControllerInfo controllerInfo)
protected override void OnAttachToController()
{
gameObject.SetActive(true);
instantiatedMaterial = new Material(objectMaterial);
displayObject.sharedMesh = availableMeshes[meshIndex];
displayObject.GetComponent<Renderer>().sharedMaterial = instantiatedMaterial;
@ -122,21 +125,19 @@ namespace HoloToolkit.Unity.ControllerExamples
state = StateEnum.Idle;
}
private void This_OnDetachFromController(MotionControllerInfo controllerInfo)
protected override void OnDetachFromController()
{
// Unsubscribe from input now that we've detached from the controller
InteractionManager.InteractionSourcePressed -= InteractionSourcePressed;
InteractionManager.InteractionSourceReleased -= InteractionSourceReleased;
Destroy(instantiatedMaterial);
//displayObject.sharedMesh = null;
state = StateEnum.Uninitialized;
}
private IEnumerator SwitchOverTime()
{
animator.SetTrigger("Switch");
// Wait for the animation to play out
while (!animator.GetCurrentAnimatorStateInfo(0).IsName("SwitchStart"))
{
@ -147,13 +148,16 @@ namespace HoloToolkit.Unity.ControllerExamples
{
yield return null;
}
// Now switch the mesh on the display object
// Then wait for the reverse to play out
displayObject.sharedMesh = availableMeshes[meshIndex];
while (animator.GetCurrentAnimatorStateInfo(0).IsName("SwitchFinish"))
{
yield return null;
}
state = StateEnum.Idle;
yield break;
}
@ -163,7 +167,7 @@ namespace HoloToolkit.Unity.ControllerExamples
released = false;
timePressed = Time.unscaledTime;
GameObject newObject = GameObject.Instantiate(displayObject.gameObject, spawnParent) as GameObject;
GameObject newObject = Instantiate(displayObject.gameObject, spawnParent);
Vector3 startScale = scaleParent.localScale;
// Hide the display object while we're scaling up the newly spawned object
displayObject.gameObject.SetActive(false);

Просмотреть файл

@ -19,8 +19,6 @@ namespace HoloToolkit.Unity.Controllers
private void Awake()
{
OnAttachToController += This_OnAttachToController;
if (pointer == null)
{
pointer = GetComponent<PhysicsPointer>();
@ -29,7 +27,7 @@ namespace HoloToolkit.Unity.Controllers
pointer.Active = false;
}
private void This_OnAttachToController(MotionControllerInfo controllerInfo)
protected override void OnAttachToController()
{
// Subscribe to interaction events
InteractionManager.InteractionSourceUpdated += InteractionSourceUpdated;
@ -37,6 +35,14 @@ namespace HoloToolkit.Unity.Controllers
InteractionManager.InteractionSourceReleased += InteractionSourceReleased;
}
protected override void OnDetachFromController()
{
// Unsubscribe from interaction events
InteractionManager.InteractionSourceUpdated -= InteractionSourceUpdated;
InteractionManager.InteractionSourcePressed -= InteractionSourcePressed;
InteractionManager.InteractionSourceReleased -= InteractionSourceReleased;
}
/// <summary>
/// Presses active
/// </summary>

Просмотреть файл

@ -223,6 +223,11 @@ namespace HoloToolkit.Unity.InputModule
MotionControllerInfo controllerInfo;
if (controllerDictionary != null && controllerDictionary.TryGetValue(GenerateKey(source), out controllerInfo))
{
if (OnControllerModelUnloaded != null)
{
OnControllerModelUnloaded(controllerInfo);
}
if (controllerInfo.Handedness == InteractionSourceHandedness.Left)
{
leftControllerModel = null;
@ -232,11 +237,6 @@ namespace HoloToolkit.Unity.InputModule
rightControllerModel = null;
}
if (OnControllerModelUnloaded != null)
{
OnControllerModelUnloaded(controllerInfo);
}
controllerInfo.ControllerParent.SetActive(false);
}
}
@ -245,7 +245,7 @@ namespace HoloToolkit.Unity.InputModule
private IEnumerator LoadControllerModel(InteractionSource source)
{
loadingControllers.Add(GenerateKey(source));
if (AlwaysUseAlternateLeftModel && source.handedness == InteractionSourceHandedness.Left)
{
if (AlternateLeftController == null)
@ -350,8 +350,7 @@ namespace HoloToolkit.Unity.InputModule
}
#endif
controllerModelGameObject = new GameObject();
controllerModelGameObject.name = "glTFController";
controllerModelGameObject = new GameObject { name = "glTFController" };
GLTFComponentStreamingAssets gltfScript = controllerModelGameObject.AddComponent<GLTFComponentStreamingAssets>();
gltfScript.ColorMaterial = GLTFMaterial;
gltfScript.NoColorMaterial = GLTFMaterial;

Просмотреть файл

@ -112,12 +112,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!114 &301956525 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 114639197955965534, guid: 56a934385f12cbd4db6dfaa5bdcb9f9f,
type: 2}
m_PrefabInternal: {fileID: 1687842798}
m_Script: {fileID: 11500000, guid: c867040d80ee6c54ba5482735391537d, type: 3}
--- !u!1001 &850491757
Prefab:
m_ObjectHideFlags: 0
@ -211,7 +205,7 @@ Prefab:
type: 2}
propertyPath: colorSource
value:
objectReference: {fileID: 301956525}
objectReference: {fileID: 1687842799}
- target: {fileID: 4969750853287846, guid: c0ccc611baa955a4080f09f3434d9d6e, type: 2}
propertyPath: m_LocalScale.x
value: 0.1
@ -307,6 +301,12 @@ Prefab:
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 56a934385f12cbd4db6dfaa5bdcb9f9f, type: 2}
m_IsPrefabParent: 0
--- !u!114 &1687842799 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 114032642240435876, guid: 56a934385f12cbd4db6dfaa5bdcb9f9f,
type: 2}
m_PrefabInternal: {fileID: 1687842798}
m_Script: {fileID: 11500000, guid: c867040d80ee6c54ba5482735391537d, type: 3}
--- !u!1001 &1862326432
Prefab:
m_ObjectHideFlags: 0

Просмотреть файл

@ -434,7 +434,7 @@ Transform:
m_PrefabParentObject: {fileID: 4378770847440034, guid: fcce4dfb5d531ca4da6eddc973d28a81,
type: 2}
m_PrefabInternal: {fileID: 927986834}
--- !u!1001 &933047435
--- !u!1001 &1084994805
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
@ -478,21 +478,6 @@ Prefab:
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 114668976894459158, guid: 073f5fc18f8dd3f43bfc0a26a586fdca,
type: 2}
propertyPath: End.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114668976894459158, guid: 073f5fc18f8dd3f43bfc0a26a586fdca,
type: 2}
propertyPath: End.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114668976894459158, guid: 073f5fc18f8dd3f43bfc0a26a586fdca,
type: 2}
propertyPath: End.z
value: 100
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 073f5fc18f8dd3f43bfc0a26a586fdca, type: 2}
m_IsPrefabParent: 0
@ -535,41 +520,11 @@ Prefab:
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 114412594797402372, guid: 54018739d95b963469324ffd1b785e1b,
type: 2}
propertyPath: Objects.Array.data[0]
value:
objectReference: {fileID: 1662993933}
- target: {fileID: 114412594797402372, guid: 54018739d95b963469324ffd1b785e1b,
type: 2}
propertyPath: Objects.Array.data[1]
value:
objectReference: {fileID: 817233151}
- target: {fileID: 114412594797402372, guid: 54018739d95b963469324ffd1b785e1b,
type: 2}
propertyPath: Objects.Array.data[2]
value:
objectReference: {fileID: 927986835}
- target: {fileID: 114412594797402372, guid: 54018739d95b963469324ffd1b785e1b,
type: 2}
propertyPath: Objects.Array.data[3]
value:
objectReference: {fileID: 1572331670}
- target: {fileID: 114412594797402372, guid: 54018739d95b963469324ffd1b785e1b,
type: 2}
propertyPath: Objects.Array.data[4]
value:
objectReference: {fileID: 1368415538}
- target: {fileID: 114412594797402372, guid: 54018739d95b963469324ffd1b785e1b,
type: 2}
propertyPath: Objects.Array.data[5]
value:
objectReference: {fileID: 291685367}
- target: {fileID: 114661879801688092, guid: 54018739d95b963469324ffd1b785e1b,
type: 2}
propertyPath: colorPicker
value:
objectReference: {fileID: 0}
objectReference: {fileID: 790017090}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54018739d95b963469324ffd1b785e1b, type: 2}
m_IsPrefabParent: 0

Просмотреть файл

@ -188,10 +188,15 @@ PlayerSettings:
iPadLandscapeSplashScreen: {fileID: 0}
iPadHighResLandscapeSplashScreen: {fileID: 0}
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
tvOSSmallIconLayers2x: []
tvOSLargeIconLayers: []
tvOSLargeIconLayers2x: []
tvOSTopShelfImageLayers: []
tvOSTopShelfImageLayers2x: []
tvOSTopShelfImageWideLayers: []
tvOSTopShelfImageWideLayers2x: []
iOSLaunchScreenType: 0
iOSLaunchScreenPortrait: {fileID: 0}
iOSLaunchScreenLandscape: {fileID: 0}
@ -298,6 +303,9 @@ PlayerSettings:
switchTitleNames_9:
switchTitleNames_10:
switchTitleNames_11:
switchTitleNames_12:
switchTitleNames_13:
switchTitleNames_14:
switchPublisherNames_0:
switchPublisherNames_1:
switchPublisherNames_2:
@ -310,6 +318,9 @@ PlayerSettings:
switchPublisherNames_9:
switchPublisherNames_10:
switchPublisherNames_11:
switchPublisherNames_12:
switchPublisherNames_13:
switchPublisherNames_14:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}
@ -322,6 +333,9 @@ PlayerSettings:
switchIcons_9: {fileID: 0}
switchIcons_10: {fileID: 0}
switchIcons_11: {fileID: 0}
switchIcons_12: {fileID: 0}
switchIcons_13: {fileID: 0}
switchIcons_14: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}
@ -334,6 +348,9 @@ PlayerSettings:
switchSmallIcons_9: {fileID: 0}
switchSmallIcons_10: {fileID: 0}
switchSmallIcons_11: {fileID: 0}
switchSmallIcons_12: {fileID: 0}
switchSmallIcons_13: {fileID: 0}
switchSmallIcons_14: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:
@ -375,6 +392,8 @@ PlayerSettings:
switchLocalCommunicationIds_7:
switchParentalControl: 0
switchAllowsScreenshot: 1
switchAllowsVideoCapturing: 1
switchAllowsRuntimeAddOnContentInstall: 0
switchDataLossConfirmation: 0
switchSupportedNpadStyles: 3
switchSocketConfigEnabled: 0
@ -518,7 +537,8 @@ PlayerSettings:
webGLCompressionFormat: 1
scriptingDefineSymbols: {}
platformArchitecture: {}
scriptingBackend: {}
scriptingBackend:
Metro: 2
incrementalIl2cppBuild: {}
additionalIl2CppArgs:
scriptingRuntimeVersion: 0