Skip to content

Commit

Permalink
Merge pull request #46 from tverona1/oculus_integration_fix
Browse files Browse the repository at this point in the history
Oculus integration timing fix to show hands
  • Loading branch information
tverona1 authored May 3, 2020
2 parents 14a6ba5 + fe735f3 commit caee2a8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 28 deletions.
9 changes: 5 additions & 4 deletions Assets/Oculus/VR/Scripts/Util/OVRMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ private void Awake()

private void Initialize(MeshType meshType)
{
_mesh = new Mesh();
if (null == _mesh)
{
_mesh = new Mesh();
}

var ovrpMesh = new OVRPlugin.Mesh();
if (OVRPlugin.GetMesh((OVRPlugin.MeshType)_meshType, out ovrpMesh))
Expand Down Expand Up @@ -120,16 +123,14 @@ private void Initialize(MeshType meshType)
}
}

#if UNITY_EDITOR
private void Update()
{
if (OVRInput.IsControllerConnected(OVRInput.Controller.Hands) && !IsInitialized)
if (!IsInitialized && OVRInput.IsControllerConnected(OVRInput.Controller.Hands))
{
if (_meshType != MeshType.None)
{
Initialize(_meshType);
}
}
}
#endif
}
9 changes: 2 additions & 7 deletions Assets/Oculus/VR/Scripts/Util/OVRMeshRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,9 @@ private void Update()
}
}
}
#if UNITY_EDITOR
else
else if (OVRInput.IsControllerConnected(OVRInput.Controller.Hands))
{
if (OVRInput.IsControllerConnected(OVRInput.Controller.Hands))
{
Initialize();
}
Initialize();
}
#endif
}
}
4 changes: 1 addition & 3 deletions Assets/Oculus/VR/Scripts/Util/OVRSkeleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,13 @@ private void InitializeCapsules(OVRPlugin.Skeleton skeleton)

private void Update()
{
#if UNITY_EDITOR
if (OVRInput.IsControllerConnected(OVRInput.Controller.Hands) && !IsInitialized)
if (!IsInitialized && OVRInput.IsControllerConnected(OVRInput.Controller.Hands))
{
if (_skeletonType != SkeletonType.None)
{
Initialize();
}
}
#endif

if (!IsInitialized || _dataProvider == null)
{
Expand Down
34 changes: 22 additions & 12 deletions Assets/Oculus/VR/Scripts/Util/OVRSkeletonRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,26 @@ private void Start()

private void Initialize()
{
_boneVisualizations = new List<BoneVisualization>();
_capsuleVisualizations = new List<CapsuleVisualization>();
_ovrSkeleton = GetComponent<OVRSkeleton>();
_skeletonGO = new GameObject("SkeletonRenderer");
_skeletonGO.transform.SetParent(transform, false);
if (null == _boneVisualizations)
{
_boneVisualizations = new List<BoneVisualization>();
}

if (null == _capsuleVisualizations)
{
_capsuleVisualizations = new List<CapsuleVisualization>();
}

if (null == _ovrSkeleton)
{
_ovrSkeleton = GetComponent<OVRSkeleton>();
}

if (null == _skeletonGO)
{
_skeletonGO = new GameObject("SkeletonRenderer");
_skeletonGO.transform.SetParent(transform, false);
}

if (_skeletonMaterial == null)
{
Expand Down Expand Up @@ -331,15 +346,10 @@ public void Update()
_capsuleVisualizations[i].Update(_scale, shouldRender, ShouldUseSystemGestureMaterial, _confidenceBehavior, _systemGestureBehavior);
}
}
#if UNITY_EDITOR
else
else if (OVRInput.IsControllerConnected(OVRInput.Controller.Hands))
{
if (OVRInput.IsControllerConnected(OVRInput.Controller.Hands) && !IsInitialized)
{
Initialize();
}
Initialize();
}
#endif
}

private void OnDestroy()
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scenes/QuestAppLauncher.unity
Original file line number Diff line number Diff line change
Expand Up @@ -8303,7 +8303,7 @@ PrefabInstance:
- target: {fileID: 114392993255165844, guid: 835e735ca71bf78459fb2cababd74112,
type: 3}
propertyPath: m_Enabled
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114392993255165844, guid: 835e735ca71bf78459fb2cababd74112,
type: 3}
Expand Down Expand Up @@ -9912,7 +9912,7 @@ PrefabInstance:
- target: {fileID: 114392993255165844, guid: 835e735ca71bf78459fb2cababd74112,
type: 3}
propertyPath: m_Enabled
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114392993255165844, guid: 835e735ca71bf78459fb2cababd74112,
type: 3}
Expand Down

0 comments on commit caee2a8

Please sign in to comment.