Skip to content

Commit c30e852

Browse files
committed
Added integration with the Unity XR Interaction Toolkit interaction system.
1 parent a64fac8 commit c30e852

33 files changed

Lines changed: 16519 additions & 2013 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes will be documented in this file.
44

5+
## [2.0.3-alpha] - 2023-10-13
6+
7+
- Adjusting samples to be compatible with the Unity OpenXR package and Unity XR Interaction Toolkit interaction system.
8+
- Added an OmnideckContinousMoveProvider class, which extends the ContinousMoveProviderBase class. Overrides the ReadInput() method to pipe the movement vector coming from the OmnitrackInterface (from Omnitrack) into the XR Interaction toolkit interaction system.
9+
- Requires XR Interaction Toolkit v2.5.2.
10+
- Tested with Unity 2022.3.4 and 2022.3.8.
11+
- Tested with Omnitrack v2.6.6.
12+
513
## [2.0.2-alpha] - 2023-07-08
614

715
- Changed OnApplicationQuit() to OnDestroy(). Fixes bug where network connection was not closed due to working with Prefabs and the Editor.

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ Navigate to the <i>Window > Package Manager</i>. Search for the <i>XR Interactio
1313
More details will follow...
1414

1515
## Samples
16-
<b>The functionality of the samples below are incomplete and do not work fully with the XR rig as of 2023-07-07. </b>
17-
18-
The package contains two simple samples that integrate the Omnideck API with a unity Gameobject.
19-
- Example 1: The Omnideck Platform uses Unity Character Controller that can collide with the surrounding objects. It has an XR Rig attached to it.
20-
- Example 2: The Omnideck Platform uses a Vector3 script, without any object collision. It has an XR Rig attached to it.
16+
The package contains three samples on how to integrate the Omnideck API with your VR application.
17+
- Example 1: Integration with the Unity XR Interaction toolkit interaction system (v2.5.2+) by adding a OmnideckContinousMoveProvider that extends the ContinousMoveProviderBase from XRI. Remember to import the XRI Starter Asset samples. Uses a Unity Character Controller that can collide with the surrounding objects. Supports hand controllers and basic interaction.
18+
- Example 2: Integration using a Unity Character Controller that can collide with the surrounding objects. It has an XR Rig attached to it.
19+
- Example 3: Integration using a Vector3 script, without any object collision. It has an XR Rig attached to it.
2120

2221
## Changelog
2322
Please see https://github.com/Omnifinity/Unity-Omnideck-API/blob/main/CHANGELOG.md

Runtime/Plugins/OmnitrackAPI.dll.meta

Lines changed: 38 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Scripts/OmnideckCharacterController.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ public enum LogLevel { None, Terse, Verbose }
3737
// The XR camera
3838
public GameObject xrCamera = null;
3939

40-
// The interface to Omnideck
41-
OmnideckInterface _omnideckInterface;
40+
// The interface to Omnideck
41+
[SerializeField]
42+
OmnideckInterface _omnideckInterface;
4243

4344
// Camera eye transform for positioning of head collider
4445
Transform _cameraTransform = null;
@@ -51,7 +52,6 @@ public enum LogLevel { None, Terse, Verbose }
5152
void Start()
5253
{
5354
// get hold of the Omnideck interface component
54-
_omnideckInterface = GetComponent<OmnideckInterface>();
5555
if (_omnideckInterface)
5656
{
5757
if (debugLevel != LogLevel.None)
@@ -120,6 +120,9 @@ void Update()
120120
// so that the user cannot move through walls
121121
if (_cameraTransform != null)
122122
_characterController.center = new Vector3(_cameraTransform.localPosition.x, 0, _cameraTransform.localPosition.z);
123+
124+
// ... and thirdly make scale the height of the character collider to match head position
125+
// TBD. Please check how this is done in the XR Interaction toolkit for inspiration on your own.
123126
}
124127
#endregion MonoBehaviorMethods
125128
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using UnityEngine;
2+
using UnityEngine.XR.Interaction.Toolkit;
3+
4+
namespace Omnifinity.Omnideck
5+
{
6+
public class OmnideckContinousMoveProvider : ContinuousMoveProviderBase
7+
{
8+
/// <summary>
9+
/// The Omnideck API
10+
/// </summary>
11+
[SerializeField]
12+
private OmnideckInterface m_omnideckInterface;
13+
14+
/// <summary>
15+
/// Tie into the LocomotionSystem
16+
/// </summary>
17+
protected override void Awake()
18+
{
19+
base.Awake();
20+
}
21+
22+
/// <summary>
23+
/// Reads the value of the move input (coming from Omnideck interface).
24+
/// Will drive the Charactercontroller via the ContinousMoveProviderBase class.
25+
/// </summary>
26+
/// <returns>Returns the input vector, for the Omnideck character.</returns>
27+
protected override Vector2 ReadInput()
28+
{
29+
if (m_omnideckInterface == null)
30+
return Vector2.zero;
31+
32+
Vector3 movementVector = m_omnideckInterface.GetCurrentOmnideckCharacterMovementVector();
33+
34+
return new Vector2(movementVector.x, movementVector.z);
35+
}
36+
}
37+
}

Runtime/Scripts/OmnideckContinousMoveProvider.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Scripts/OmnideckVector3.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public enum LogLevel { None, Terse, Verbose }
3131
public LogLevel debugLevel = LogLevel.Verbose;
3232

3333
// our interface of interest
34+
[SerializeField]
3435
OmnideckInterface _omnideckInterface;
3536

3637
// Camera eye transform for positioning of head collider
@@ -41,7 +42,6 @@ public enum LogLevel { None, Terse, Verbose }
4142
void Start()
4243
{
4344
// get hold of the Omnideck interface component
44-
_omnideckInterface = GetComponent<OmnideckInterface>();
4545
if (_omnideckInterface)
4646
{
4747
if (debugLevel != LogLevel.None)

Runtime/omnifinity.omnideck.asmdef

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "omnifinity.omnideck",
33
"rootNamespace": "",
4-
"references": [],
4+
"references": [
5+
"GUID:fe685ec1767f73d42b749ea8045bfe43"
6+
],
57
"includePlatforms": [],
68
"excludePlatforms": [],
79
"allowUnsafeCode": false,
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 8
6+
m_ObjectHideFlags: 0
7+
m_CorrespondingSourceObject: {fileID: 0}
8+
m_PrefabInstance: {fileID: 0}
9+
m_PrefabAsset: {fileID: 0}
10+
m_Name: Ground plane
11+
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12+
m_Parent: {fileID: 0}
13+
m_ModifiedSerializedProperties: 0
14+
m_ValidKeywords: []
15+
m_InvalidKeywords: []
16+
m_LightmapFlags: 4
17+
m_EnableInstancingVariants: 0
18+
m_DoubleSidedGI: 0
19+
m_CustomRenderQueue: -1
20+
stringTagMap: {}
21+
disabledShaderPasses: []
22+
m_LockedProperties:
23+
m_SavedProperties:
24+
serializedVersion: 3
25+
m_TexEnvs:
26+
- _BumpMap:
27+
m_Texture: {fileID: 0}
28+
m_Scale: {x: 1, y: 1}
29+
m_Offset: {x: 0, y: 0}
30+
- _DetailAlbedoMap:
31+
m_Texture: {fileID: 0}
32+
m_Scale: {x: 1, y: 1}
33+
m_Offset: {x: 0, y: 0}
34+
- _DetailMask:
35+
m_Texture: {fileID: 0}
36+
m_Scale: {x: 1, y: 1}
37+
m_Offset: {x: 0, y: 0}
38+
- _DetailNormalMap:
39+
m_Texture: {fileID: 0}
40+
m_Scale: {x: 1, y: 1}
41+
m_Offset: {x: 0, y: 0}
42+
- _EmissionMap:
43+
m_Texture: {fileID: 0}
44+
m_Scale: {x: 1, y: 1}
45+
m_Offset: {x: 0, y: 0}
46+
- _MainTex:
47+
m_Texture: {fileID: 0}
48+
m_Scale: {x: 1, y: 1}
49+
m_Offset: {x: 0, y: 0}
50+
- _MetallicGlossMap:
51+
m_Texture: {fileID: 0}
52+
m_Scale: {x: 1, y: 1}
53+
m_Offset: {x: 0, y: 0}
54+
- _OcclusionMap:
55+
m_Texture: {fileID: 0}
56+
m_Scale: {x: 1, y: 1}
57+
m_Offset: {x: 0, y: 0}
58+
- _ParallaxMap:
59+
m_Texture: {fileID: 0}
60+
m_Scale: {x: 1, y: 1}
61+
m_Offset: {x: 0, y: 0}
62+
m_Ints: []
63+
m_Floats:
64+
- _BumpScale: 1
65+
- _Cutoff: 0.5
66+
- _DetailNormalMapScale: 1
67+
- _DstBlend: 0
68+
- _GlossMapScale: 1
69+
- _Glossiness: 0.5
70+
- _GlossyReflections: 1
71+
- _Metallic: 0
72+
- _Mode: 0
73+
- _OcclusionStrength: 1
74+
- _Parallax: 0.02
75+
- _SmoothnessTextureChannel: 0
76+
- _SpecularHighlights: 1
77+
- _SrcBlend: 1
78+
- _UVSec: 0
79+
- _ZWrite: 1
80+
m_Colors:
81+
- _Color: {r: 0.49056602, g: 0.4183695, b: 0.4183695, a: 1}
82+
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
83+
m_BuildTextureStacks: []

Samples~/SamplesVector3/Prefabs/Omnideck Platform Vector 3.prefab.meta renamed to Samples~/SamplesCharacterController/Ground plane.mat.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)