This document outlines the Unity sample which shows how to receive Open SDK data via OSC in a third-party Unity Application.
INFO: The StretchSense Plugin for Unity 3.2.0 release candidates are currently in closed beta and are available upon request for integrators and StretchSense customers.
The StretchSense Plugin for Unity 3.2.0-RC3 package contains the following samples:
animation/rotation OSC address to a VRM model imported into the project using UniVRM. The data is retargeted by Hand Engine using the RAYNOS-chan-1.0.4 retargeting model. This data overrides any animation already applied to the hands of the character.Requires the Open Sound Control Core v2.0.0 fork by Virtual Cast, Inc. to receive OSC messages from Hand Engine.
Optionally requires the UniVRM UPM package to be added to your Unity project to load the included VRoid Hub VRM sample models. If you are not using these models, you can safely delete these and their prefabs from the sample. If using URP in your project and using the VRM samples models, we recommend using the lilToon shaders instead of the UniVRM ones.
animation/rotationWithMetacarpals OSC address to the hand rig from the VIVE-Wave SDK.NOTE: Requires the Open SDK OSC sample to also be imported.
NOTE: Requires the RAYNOS-chan avatar from the Sony mocopi site .
Install Hand Engine 3.1.2 Open SDK Beta or higher and open Edit → Settings and set the following. Ensure the Enabled switch is toggled ON so Open SDK OSC messages are sent out from Hand Engine to third party applications running on the same PC.
Use the following IP addresses for sending OSC messages to your application:
127.0.0.1 - localhost loopback to the same PC that is running your Unity project either in the Unity Editor or as a build of your Unity project (EXE, APK etc).
9401 if you wish to debug the outgoing Open SDK OSC messages from within Hand Engine using Tools → Open SDK Test Console to see the order of OSC attributes in each message. Note that the type of each OSC attribute isn’t shown in the test console, so please refer to the Open SDK API Documentation for details.
3. In order to receive animation/rotation and animation/position OSC messages, you must have your gloves connected to Hand Engine and assigned to at least one performer. A default performer is already set up for you in Hand Engine after installation. Connect the gloves and select them from the dropdowns on the left- and right-hand side:
4. Perform a glove calibration for each glove by clicking Calibrate and follow the on-screen instructions to complete the calibration. Check the hands move on screen.
5. After this, when accessing Tools → Open SDK Test Console you will see OSC messages being sent out of Hand Engine for every OSC address that has been toggled ON in Edit → Settings:
6. If you don’t see any messages listed on this screen, you may have another app or service on your PC using the Open SDK Test Console port; try changing it to another value.
Add the following packages via UPM:
Open Sound Control Core v2.0.0 fork by Virtual Cast, Inc. This fork corrects issues with receiving string OSC argument types.
OscCore from the Samples tab in the Unity Package Manager.Install this package if you are planning to use VRM models in your Unity project from the Open SDK OSC sample. We have provided sample VRM models from VRoid Hub for convenience so the sample scene will work out of the box with no modification.
In the Hand Engine settings the default retargeting preset will output bone rotations retargeted for a VRM model. The original retargeting preset is based on Sony’s RAYNOS-chan avatar which is compatible with UniVRM.
After installation, any VRM models from the Models folder in this sample will automatically be converted into Unity prefabs which you can place in your scene. They will have their shaders and other supporting scripts added. This sample has the following VRM 1.0 models pre-configured in the StretchSense Open SDK Studio Demo scene:
secondary GameObject in each VRM model prefab. You can adjust these or enable/disable them depending on which body parts or clothing you want physics to be enabled on. Optionally you can add the Blinker script from the UniVRM package to get automatic blinking for the eye blend shapes on your VRM characters. VRM 0.x models are also supported by UniVRM.The Open SDK sample comes with an AI generated looping animation created using Unity Muse Animate which you are free to use in your projects. Alternatively, you can retarget any FBX animation onto a VRM character imported by UniVRM using the following process:
This allows you to combine an existing pre-recorded animation with StretchSense glove data on a VRM character while testing. Not all animation controllers and animations are directly compatible with VRM models imported via UniVRM, so this provides a workaround.
2. Drag the FBX that contains this animation into your scene to create a GameObject of it.
3. Add a Human Pose Transfer component to the GameObject in your scene.
4. Add the VRM character prefab to your scene. We have example ones available in the Models/VRM folder of this sample (AvatarSample_A, AvatarSample_B, AvatarSample_C) that have already been imported using UniVRM.
5. Add a second Human Pose Transfer component to your VRM character in the scene.
6. Set the following properties:
SkinnedMeshRenderer enabled in your FBX animation GameObject. The StretchSense glove hand animation data will be applied on top of the FBX animation if Hand Engine is configured as per this guide and it is running with StretchSense gloves connected.Required if using the performance graph prefab from the StretchSense Open SDK Studio Demo sample scene. The performance graph will automatically enable the action provided for FPSGraph.cycleActionRef on scene start.
com.unity.inputsystem.Samples/StretchSense Studio Plugin/3.2.0-RC3/Open SDK OSC/Scenes/StretchSense Open SDK Studio Demo.unity.unitypackage to your project.Assets/Samples/StretchSense Studio Plugin/3.2.0-RC3/VIVE-Wave/Scenes/StretchSense Open SDK for VIVE-Wave Demo.
4. Turn off un-needed OSC addresses. This will improve performance over the network for your headset when receiving animation data. Make sure
animation/rotationWithMetacarpals is turned on.
5. Build and deploy your app to the headset.
6. Run the app on your headset. If a connection is successful, the VIVE-Wave hand rig’s fingers will animate.
When using OscCore, you need to know the type of OSC message attributes relative to their index in the OSC message in order to correctly parse them. We have limited OSC attribute types to floats, integers and strings to maximize compatibility with various OSC libraries and programming languages.
You can use the following tools to help with this:
9401 in order to see messages in this console. This port is not setup by default for end users as there is a small performance impact sending messages to this console.| Changelog | Version | Publish Date (YYYY/MM/DD) |
|---|---|---|
| Initial version. | v1.0.0 | 2024/05/14 |