Unity

UCA Tutorial #1: Hello (Sensation) World

1392 views 19/02/2019 Nicci 5

Next tutorial: Sensation Source Playback

Introduction

In our first tutorial, we introduce the basics of setting up a Unity® scene to use Ultrahaptics Core Asset and some key concepts – the Sensation Source and Sensation Emitter. We install the UCA and create the most basic Unity scene to project a circle sensation centred above the array. We’ll also set up our Unity scene to make sure we can properly see the position of the array and the sensation and show you how to control what sensation is emitted and the sensation’s position.

New to Unity?

While our Ultrahaptics Core Asset (UCA) for Unity tutorials are not technically difficult to understand, we do make some assumptions about your familiarity and experience with Unity. If you are not familiar with Unity terminology and technicalities such as importing packages, Game Objects, “Unity World”, gizmos and C# scripting, we recommend that you have a look at some of the many excellent online resources for learning Unity.

Their beginner tutorials are a very good place to start.

Our first UCA scene

1. Create a workspace folder for all your Ultrahaptics Unity projects and a new Unity project.

2. Download the Ultrahaptics Core Asset (UCA), save and unzip it to your workspace.

3. Import the UCA asset into your Unity project.

4. From UltrahapticsCoreAsset/Prefabs, add the UltrahapticsKit to your scene. Reset its transform to zero.

5. Change the Main Camera’s transform position to {0, 0.4, -0.4} and X rotation to 30˚.

6. Create an empty Game Object and give it a name, such as “Sensation”. Reset its transform to zero.

7. Add a Sensation Source component – click the “Add Component” button and start typing “Sensation Source”, select the component.

UCA Add Sensation Source

8. From the Sensation Block field dropdown list, select CircleSensation.

UCA Select Sensation

9. The associated inputs, radiusTransform, will appear below.

  • The Transform behaves like any Unity Transform control, setting the sensation’s position, rotation, and scale. Drag the Sensation game object’s Transform component onto this field. Set the Transform’s Position to {0, 0.2, 0}. Values are in Unity world units, where 1 Unity unit = 1 metre.
  • The default radius is 0.02.

10. Check the “Running” check box to enable the Sensation Source’s running status:

UCA Sensation Source Running State

11. Connect up your hardware and click the Unity Play button. You should feel the Circle sensation fixed 20 cm above the array.

Tutorial 1 circleSensation

Hardware

To see your hardware status, select the Hardware Info menu-item from the Ultrahaptics menu and click Refresh. It will show the pane illustrated with your device details. If no hardware is connected this will be indicated as shown.

UCA Hardware Info

The ‘Sensation Source’

The SensationSource UCA component is used to create our haptic sensation, allowing us to select a “Sensation Block” and set its parameters. We will be using SensationSource components throughout the lessons and going into more detail later. For now:

  • Hover over each of the properties to read its tooltip.

UCA Tool tips

  • Experiment with the CircleSensation’s radius and the game object’s Transform
  • Confirm that the Running check box enables and disables haptic output.
  • Change the Sensation Block field to LineSensation and experiment with the endpoint input.
  • Read the list of built-in UCA Sensation Blocks in the md file. You will find this in the root folder of the asset.
  • Not all blocks generate haptic output!

The ‘Ultrahaptics Kit’ Prefab

The UltrahapticsKit prefab contains Unity components needed to communicate with the array, a graphical representation and some helper components for positioning. We’ll go into more detail on these later.

Note: there should only be one ENABLED Sensation Emitter on your system. If editing more than one UCA project, disable any other Sensation Emitters by unchecking the box marked below:

UCA Ultrahaptics Kit prefab

Next tutorial: Sensation Source Playback

Was this helpful?