Skip to content

Commit

Permalink
Release v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
N0RAIR committed Oct 2, 2020
1 parent 9260607 commit 23d2913
Show file tree
Hide file tree
Showing 69 changed files with 28,090 additions and 24,628 deletions.
15 changes: 5 additions & 10 deletions Docs/BUTTONS_INTERACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ If you are not familar with the Interactable Component, first have a look here [

## How to configure Interactable Component so it reacts to Stylus Button Interactions

Select the `Stylus Action` from the Input Actions list so it triggers ONLY on the ACTION (Front) Button. That's all :slightly_smiling_face: When you select the `Stylus Back` it will trigger when you press the BACK Button.
Choose the `Select` from the Input Actions list so the interactable triggers on the (Front) Stylus Button. That's all :slightly_smiling_face: When you select the `Stylus Back` it will trigger when you press the BACK Button.

> :information_source: If you want it to trigger as well with e.g. Hand Gestures then have a look here ([Using Stylus with other Controllers](STYLUS_CONTROLLER.md))
> :information_source: If you want it to trigger as well with e.g. Hand Gestures then have a look here ([Using Stylus with other Controllers (deprecated since v1.0.4)](STYLUS_CONTROLLER.md))
<p align="center">
<img src="imgs/InteractableStylusAction.png" width="70%">
<img src="imgs/InteractableStylusSelect.png" width="60%">
</p>

## How to configure Pressable Buttons to work by pressing it with the Stylus Tip
Expand All @@ -27,14 +27,9 @@ Select the `Stylus Action` from the Input Actions list so it triggers ONLY on th
<img src="imgs/PushableButton2.png" width="35%" style="display: inline">
</p>

A good reference for the pressable buttons is [MRTK Pressable Buttons](https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/README_Button.html#collider-based-buttons-1)

Just change the Input Action to `Stylus Action` of the Interactable Compontent where the PressableButton is attached to. There you go :slightly_smiling_face:

Good news! You don't have change anything. If the Input Action is set to `Select` of the Interactable Compontent where the PressableButton is attached to, it will react if the Stylus Tip presses that button. There you go :slightly_smiling_face:

<p align="center">
<img src="imgs/PushableButton3.png" width="70%">
</p>
A good reference for the pressable buttons is [MRTK Pressable Buttons](https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/README_Button.html#collider-based-buttons-1)

## How to use Bounding Box and Manipulation Handler

Expand Down
4 changes: 3 additions & 1 deletion Docs/EVENTS_ONCONNECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
3. Add your events inside OnStylusConnected and OnStylusDisconnected

**OnStylusConnected** triggers when the application gets streaming data from the HMU<br>
**OnStylusDisconnected** triggers when the applicatoin doesn’t get anything from the HMU for 3s
**OnStylusDisconnected** triggers when the Bluetooth Device disconnects (beginning with v1.0.4)

**OnStylusDisconnected** triggers when the application doesn’t get anything from the HMU for 3s (until v1.0.3)

<p align="center">
<img src="imgs/Event_OnConnect.png" width="50%">
Expand Down
18 changes: 16 additions & 2 deletions Docs/EVENTS_ONINPUT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# OnInputDown/OnInputUp

Add the InputActionHandler to your GameObject and select the Input Action Type (Stylus Action or Stylus Back).
Add the InputActionHandler to your GameObject and select the Input Action Type `Select` or `Stylus Back`.
Configure if you want the events to trigger only if the GameObject is focused.
<p align="center">
<img src="imgs/Event_OnInput.png" width="70%">
</p>
</p>

```csharp
public void OnInputDown(BaseInputEventData inputEventData)
{
if (inputEventData.InputSource.SourceName.Contains("Stylus"))
{
// Stylus XR Input Down!!
// do stuff...
} else {
// Other Controller Input Down
// do stuff...
}
}
```
2 changes: 1 addition & 1 deletion Docs/FEATURE_MEASUREMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In order to use the Measurement Feature, you need the **MeasurementManager** pre

You just need to call the function Activate() to start with the measuring process. The first ACTION click will set the first point, the second click will set the second point. Then the line between these points will be drawn and the distance shown. That's all! :slightly_smiling_face:

By default, the Measurements are dynamic and can be resized and moved, after they are created. You can disable that, by unticking the "Dynamic Measurements" on the MeasurementManager Component. When a measurement is created it puts them as child of the **MeasurementsContainer**. If the MeasurementManager has no GameObject assigend for it, it creates a new GameObject and uses it as parent for all the created Measurements.
By default, the Measurements are dynamic and can be resized and moved, after they are created. You can disable that, by unticking the `Dynamic Measurements` on the MeasurementManager Component. When a measurement is created it puts them as child of the **MeasurementsContainer**. If the MeasurementManager has no GameObject assigend for it, it creates a new GameObject and uses it as parent for all the created Measurements.


**Example: Start the Measurement by pressing on a Button**
Expand Down
2 changes: 1 addition & 1 deletion Docs/STYLUS_CONFIGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ When set to Auto Start, after the App started, it will directly start searching

When set to Manual Start you have to manually call the function (HoloStylusManager.StartStylus()) which will start searching for a HMU and connect (if a cached device is found). - Manual Start is recommended, if the Stylus is an optional Input Device in your App

**Connect To Last Device** (default is **enabled**)
**Connect To Last Device** (default is **disabled**)

When set to enabled, once it finds the device which was connected last time, it will automatically connect to it.

Expand Down
4 changes: 3 additions & 1 deletion Docs/STYLUS_CONTROLLER.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Using Stylus XR with other Controllers
# Using Stylus XR with other Controllers (deprecated)

<p style="color:#ff3300;font-size:24px; line-height: 24px">Beginning with STK v1.0.4 it is not needed to do this!!! The Front Button is mapped on `Select` Input Action!!! So the Stylus XR should work out of the box, when your interactables have the `Select` Input Action</p>

In order to make the **Interactables** work with the standard Input Methods like, Gaze+Airtap, Handray, etc. in combination WITH the Stylus XR, then this guide will help you with it.

Expand Down
26 changes: 26 additions & 0 deletions Docs/STYLUS_UI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Stylus XR User Interface

When you look inside the **Stylus** prefab, there is another prefab called **StylusUI**.
When this GameObject is in the Scene, you will get a out-of-the-box working UI Panel to list/connect to the devices.
If you want to create your own UI, have a look inside `Holo-Light/STK/Core/Connection/StylusUI.cs`. There you can see how it is made.

<p align="center">
<img src="imgs/StylusUI.png" width="45%">
<img src="imgs/StylusUI2.png" width="45%">
</p>


Basically you just need a reference to HoloStylusManager which exists only on the **Stylus** GameObject.
There you can register for different types of events to handle your UI.

* StartSearchEvent
* DeviceFoundEvent
* DeviceSearchCompleteEvent
* ConnectingStarted
* OnStylusReady
* ConnectionTimeoutEvent

...just to name a few.
<br>

If you don't want the default UI, and want your customized version, just remove the **StylusUI** from your scene.
7 changes: 7 additions & 0 deletions Docs/STYLUS_UI.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Docs/imgs/Event_OnInput.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Docs/imgs/InteractableStylusAction.png
Binary file not shown.
Binary file added Docs/imgs/InteractableStylusSelect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Docs/imgs/StylusConfigProfile5.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/imgs/StylusUI.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions Docs/imgs/StylusUI.PNG.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Docs/imgs/StylusUI2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions Docs/imgs/StylusUI2.PNG.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ Have a look at our [Quick Start Guide](https://support.holo-light.com/hc/en-us/a

* [Setup Scene for Stylus XR](Docs/SETUP_SCENE.md)
* [Buttons & Interaction Components](Docs/BUTTONS_INTERACTIONS.md)
* [Using Stylus XR with other Controllers](Docs/STYLUS_CONTROLLER.md)
* [Configuring MRTK Profiles for Stylus XR](Docs/STYLUS_PROFILES.md)
* [Stylus XR Configurations](Docs/STYLUS_CONFIGS.md)
* [Stylus XR User Interface](Docs/STYLUS_UI.md)
* [Using Stylus XR with other Controllers (deprecated starting from v1.0.4)](Docs/STYLUS_CONTROLLER.md)
- EVENTS
- [OnConnected/OnDisconnected](Docs/EVENTS_ONCONNECT.md)
- [OnClick/OnHold/OnPress/...](Docs/EVENTS_ONCLICKHOLD.md)
Expand Down
41 changes: 25 additions & 16 deletions Runtime/Holo-Light/STK/Core/Calibration/CalibrationManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

using HoloLight.STK.MRTK;
using Microsoft.MixedReality.Toolkit.Input;
using UnityEngine;
using static HoloLight.STK.Core.CalibrationPreferences;

Expand Down Expand Up @@ -101,33 +102,41 @@ public void ResetCalibration()
UpdateOffset(resetCoordinates, resetRotation);
}

public void OnButtonDown(int BUTTON_ID)
public void OnButtonDown(BaseInputEventData inputEventData)
{
if (BUTTON_ID == (int)_triggerOn)
if (inputEventData.InputSource.SourceName.Contains("Stylus"))
{
_cursorOldTransform = _stylusCursor.transform.parent;
_stylusCursor.transform.parent = _camera.transform;
string compareToString = _triggerOn == 0 ? "Select" : "Stylus Back";
if (inputEventData.MixedRealityInputAction.Description.Contains(compareToString))
{
_cursorOldTransform = _stylusCursor.transform.parent;
_stylusCursor.transform.parent = _camera.transform;

_manager.PointerSwitcher.DisablePointer(StylusPointerSwitcher.PointerType.StylusRayPointer);
_startPosition = _camera.transform.InverseTransformPoint(_stylusCursor.transform.position);
_startRotation = _manager.StylusTransform.RawRotation;
_manager.PointerSwitcher.DisablePointer(StylusPointerSwitcher.PointerType.StylusRayPointer);
_startPosition = _camera.transform.InverseTransformPoint(_stylusCursor.transform.position);
_startRotation = _manager.StylusTransform.RawRotation;

_stylusController.DisablePositionChanges();
_stylusController.DisablePositionChanges();
}
}
}

public void OnButtonUp(int BUTTON_ID)
public void OnButtonUp(BaseInputEventData inputEventData)
{
if (BUTTON_ID == (int)_triggerOn)
if (inputEventData.InputSource.SourceName.Contains("Stylus"))
{
_manager.PointerSwitcher.EnablePointer(StylusPointerSwitcher.PointerType.StylusRayPointer);
Vector3 newPositionOffset = _camera.transform.InverseTransformPoint(_manager.StylusTransform.Position) - _startPosition;
Vector3 newRotationOffset = _manager.StylusTransform.RawRotation - _startRotation;
string compareToString = _triggerOn == 0 ? "Select" : "Stylus Back";
if (inputEventData.MixedRealityInputAction.Description.Contains(compareToString))
{
_manager.PointerSwitcher.EnablePointer(StylusPointerSwitcher.PointerType.StylusRayPointer);
Vector3 newPositionOffset = _camera.transform.InverseTransformPoint(_manager.StylusTransform.Position) - _startPosition;
Vector3 newRotationOffset = _manager.StylusTransform.RawRotation - _startRotation;

UpdateOffset(newPositionOffset, newRotationOffset);
UpdateOffset(newPositionOffset, newRotationOffset);

_stylusController.EnablePositionChanges();
_stylusCursor.transform.parent = _cursorOldTransform;
_stylusController.EnablePositionChanges();
_stylusCursor.transform.parent = _cursorOldTransform;
}
}
}

Expand Down
Loading

0 comments on commit 23d2913

Please sign in to comment.