Merge pull request #7 from cre8ivepark/master
Removing unnecessary selectPressedAmount related code from the basic BrushController
This commit is contained in:
Коммит
2bea32edd1
|
@ -56,22 +56,22 @@ namespace HoloToolkit.Unity.ControllerExamples
|
|||
private ColorPickerWheel colorPicker;
|
||||
private Color currentStrokeColor = Color.white;
|
||||
private bool draw = false;
|
||||
|
||||
// Default storke width is defined in BrushThinStroke.prefab
|
||||
private float width = 0f;
|
||||
private float lastPointAddedTime = 0f;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
// Subscribe to press events for drawing
|
||||
// Subscribe to press and release events for drawing
|
||||
InteractionManager.InteractionSourcePressed += InteractionSourcePressed;
|
||||
InteractionManager.InteractionSourceReleased += InteractionSourceReleased;
|
||||
InteractionManager.InteractionSourceUpdated += InteractionSourceUpdated;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
InteractionManager.InteractionSourcePressed -= InteractionSourcePressed;
|
||||
InteractionManager.InteractionSourceReleased -= InteractionSourceReleased;
|
||||
InteractionManager.InteractionSourceUpdated -= InteractionSourceUpdated;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -93,14 +93,6 @@ namespace HoloToolkit.Unity.ControllerExamples
|
|||
}
|
||||
}
|
||||
|
||||
private void InteractionSourceUpdated(InteractionSourceUpdatedEventArgs obj)
|
||||
{
|
||||
if (obj.state.source.handedness == InteractionSourceHandedness.Right)
|
||||
{
|
||||
width = obj.state.selectPressedAmount;
|
||||
}
|
||||
}
|
||||
|
||||
private void InteractionSourceReleased(InteractionSourceReleasedEventArgs obj)
|
||||
{
|
||||
if (obj.state.source.handedness == InteractionSourceHandedness.Right && obj.pressType == InteractionSourcePressType.Select)
|
||||
|
@ -130,12 +122,12 @@ namespace HoloToolkit.Unity.ControllerExamples
|
|||
// If we're not still drawing after one frame
|
||||
if (!draw)
|
||||
{
|
||||
// This was a fluke, abort!
|
||||
// Abort drawing
|
||||
yield break;
|
||||
}
|
||||
|
||||
Vector3 startPosition = tip.position;
|
||||
// Create a new brush stroke
|
||||
// Create a new brush stroke by instantiating stokePrefab
|
||||
GameObject newStroke = Instantiate(strokePrefab);
|
||||
LineRenderer line = newStroke.GetComponent<LineRenderer>();
|
||||
newStroke.transform.position = startPosition;
|
||||
|
@ -150,7 +142,6 @@ namespace HoloToolkit.Unity.ControllerExamples
|
|||
line.material.color = colorPicker.SelectedColor;
|
||||
brushRenderer.material.color = colorPicker.SelectedColor;
|
||||
lastPointAddedTime = Time.unscaledTime;
|
||||
// Adjust the width between 1x and 2x width based on strength of trigger pull
|
||||
line.widthMultiplier = Mathf.Lerp(initialWidth, initialWidth * 2, width);
|
||||
|
||||
if (Vector3.Distance(lastPointPosition, tip.position) > minPositionDelta || Time.unscaledTime > lastPointAddedTime + maxTimeDelta)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4f106707aefa5e44591b0c72cab2b44a
|
||||
timeCreated: 1481757313
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c54c43fae64ba1845a3579779818700a
|
||||
timeCreated: 1481757313
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 586bf14c7c7de5b418595eec11505982
|
||||
timeCreated: 1481762238
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c7b57dac0ac191541831c7398a7226e8
|
||||
timeCreated: 1481762238
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ffba62fc49d82b4fb482673e4a6a03a
|
||||
timeCreated: 1488424603
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1a995452991a07b4080c6e0749d0ecb2
|
||||
timeCreated: 1495737220
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ba5d0cb6a39b4a84797f85bdc712d35d
|
||||
timeCreated: 1495737382
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 988367d1bf658ff46b8634cea1906dfa
|
||||
timeCreated: 1495737290
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Загрузка…
Ссылка в новой задаче