@@ -0,0 +1,84 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DefaultHandMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 6c4707981f2aec7459b4fdacd593ff27, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _FresnelPower: 0.215
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _HandAlpha: 1
|
||||
- _Metallic: 0
|
||||
- _MinVisibleAlpha: 0.164
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _RimFactor: 0.922
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorBottom: {r: 0.36154413, g: 0.560827, b: 0.8088235, a: 1}
|
||||
- _ColorPrimary: {r: 0.75735295, g: 0.75735295, b: 0.75735295, a: 1}
|
||||
- _ColorTop: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0df12b5511b088d4c85a129ef70af305
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,88 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SkeletonBoneMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 6c4707981f2aec7459b4fdacd593ff27, type: 3}
|
||||
m_ShaderKeywords: _ALPHATEST_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _FresnelPower: 0.16
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _HandAlpha: 1
|
||||
- _Metallic: 0
|
||||
- _MinVisibleAlpha: 0.1
|
||||
- _Mode: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _RimFactor: 0.66
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorBottom: {r: 0.69411767, g: 0.7254902, b: 0.7529412, a: 1}
|
||||
- _ColorPrimary: {r: 0.69419724, g: 0.727208, b: 0.754717, a: 1}
|
||||
- _ColorTop: {r: 0.69411767, g: 0.7254902, b: 0.7529412, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5eec8807c5526ce4396daa4d3d31259a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,84 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SystemGestureHandMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 6c4707981f2aec7459b4fdacd593ff27, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _FresnelPower: 0.215
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _HandAlpha: 1
|
||||
- _Metallic: 0
|
||||
- _MinVisibleAlpha: 0.164
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _RimFactor: 0.922
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorBottom: {r: 0.9852941, g: 0.97749966, b: 0.7027465, a: 1}
|
||||
- _ColorPrimary: {r: 0.75735295, g: 0.75735295, b: 0.75735295, a: 1}
|
||||
- _ColorTop: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 135e7828c00a165428394051b63e55aa
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,88 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SystemGestureSkeletonBoneMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 6c4707981f2aec7459b4fdacd593ff27, type: 3}
|
||||
m_ShaderKeywords: _ALPHATEST_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _FresnelPower: 0.16
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _HandAlpha: 1
|
||||
- _Metallic: 0
|
||||
- _MinVisibleAlpha: 0.1
|
||||
- _Mode: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _RimFactor: 0.66
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorBottom: {r: 0.9843137, g: 0.9764706, b: 0.7019608, a: 1}
|
||||
- _ColorPrimary: {r: 0.69419724, g: 0.727208, b: 0.754717, a: 1}
|
||||
- _ColorTop: {r: 0.69411767, g: 0.7254902, b: 0.7529412, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 205613560f9b94149817adcb207284ca
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,372 @@
|
||||
/************************************************************************************
|
||||
|
||||
Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
See SampleFramework license.txt for license terms. Unless required by applicable law
|
||||
or agreed to in writing, the sample code is provided “AS IS” WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied. See the license for specific
|
||||
language governing permissions and limitations under the license.
|
||||
|
||||
************************************************************************************/
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace ControllerSelection
|
||||
{
|
||||
public class HandsManager : MonoBehaviour
|
||||
{
|
||||
private const string SKELETON_VISUALIZER_NAME = "SkeletonRenderer";
|
||||
|
||||
[SerializeField] GameObject _leftHand = null;
|
||||
[SerializeField] GameObject _rightHand = null;
|
||||
|
||||
public HandsVisualMode VisualMode = HandsVisualMode.Mesh;
|
||||
private OVRHand[] _hand = new OVRHand[(int)OVRHand.Hand.HandRight + 1];
|
||||
private OVRSkeleton[] _handSkeleton = new OVRSkeleton[(int)OVRHand.Hand.HandRight + 1];
|
||||
private OVRSkeletonRenderer[] _handSkeletonRenderer = new OVRSkeletonRenderer[(int)OVRHand.Hand.HandRight + 1];
|
||||
private OVRMesh[] _handMesh = new OVRMesh[(int)OVRHand.Hand.HandRight + 1];
|
||||
private OVRMeshRenderer[] _handMeshRenderer = new OVRMeshRenderer[(int)OVRHand.Hand.HandRight + 1];
|
||||
private SkinnedMeshRenderer _leftMeshRenderer = null;
|
||||
private SkinnedMeshRenderer _rightMeshRenderer = null;
|
||||
private GameObject _leftSkeletonVisual = null;
|
||||
private GameObject _rightSkeletonVisual = null;
|
||||
private float _currentHandAlpha = 1.0f;
|
||||
private int HandAlphaId = Shader.PropertyToID("_HandAlpha");
|
||||
private PinchMode[] _pinchModeLeft = new PinchMode[(int)OVRHand.HandFinger.Max];
|
||||
private PinchMode[] _pinchModeRight = new PinchMode[(int)OVRHand.HandFinger.Max];
|
||||
private PinchMode[] _lastPinchModeLeft = new PinchMode[(int)OVRHand.HandFinger.Max];
|
||||
private PinchMode[] _lastPinchModeRight = new PinchMode[(int)OVRHand.HandFinger.Max];
|
||||
|
||||
// Pinch strength to be considered a pinch
|
||||
static readonly float PinchMaxStrength = 0.9f;
|
||||
|
||||
public enum HandsVisualMode
|
||||
{
|
||||
Mesh = 0, Skeleton = 1, Both = 2
|
||||
}
|
||||
|
||||
public enum PinchMode
|
||||
{
|
||||
Pinched = 0, NotPinched = 1
|
||||
}
|
||||
|
||||
public OVRHand RightHand
|
||||
{
|
||||
get
|
||||
{
|
||||
return _hand[(int)OVRHand.Hand.HandRight];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_hand[(int)OVRHand.Hand.HandRight] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRSkeleton RightHandSkeleton
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handSkeleton[(int)OVRHand.Hand.HandRight];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handSkeleton[(int)OVRHand.Hand.HandRight] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRSkeletonRenderer RightHandSkeletonRenderer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handSkeletonRenderer[(int)OVRHand.Hand.HandRight];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handSkeletonRenderer[(int)OVRHand.Hand.HandRight] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRMesh RightHandMesh
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handMesh[(int)OVRHand.Hand.HandRight];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handMesh[(int)OVRHand.Hand.HandRight] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRMeshRenderer RightHandMeshRenderer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handMeshRenderer[(int)OVRHand.Hand.HandRight];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handMeshRenderer[(int)OVRHand.Hand.HandRight] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRHand LeftHand
|
||||
{
|
||||
get
|
||||
{
|
||||
return _hand[(int)OVRHand.Hand.HandLeft];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_hand[(int)OVRHand.Hand.HandLeft] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRSkeleton LeftHandSkeleton
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handSkeleton[(int)OVRHand.Hand.HandLeft];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handSkeleton[(int)OVRHand.Hand.HandLeft] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRSkeletonRenderer LeftHandSkeletonRenderer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handSkeletonRenderer[(int)OVRHand.Hand.HandLeft];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handSkeletonRenderer[(int)OVRHand.Hand.HandLeft] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRMesh LeftHandMesh
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handMesh[(int)OVRHand.Hand.HandLeft];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handMesh[(int)OVRHand.Hand.HandLeft] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRMeshRenderer LeftHandMeshRenderer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _handMeshRenderer[(int)OVRHand.Hand.HandLeft];
|
||||
}
|
||||
private set
|
||||
{
|
||||
_handMeshRenderer[(int)OVRHand.Hand.HandLeft] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static HandsManager Instance { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance && Instance != this)
|
||||
{
|
||||
Destroy(this);
|
||||
return;
|
||||
}
|
||||
Instance = this;
|
||||
|
||||
Assert.IsNotNull(_leftHand);
|
||||
Assert.IsNotNull(_rightHand);
|
||||
|
||||
LeftHand = _leftHand.GetComponent<OVRHand>();
|
||||
LeftHandSkeleton = _leftHand.GetComponent<OVRSkeleton>();
|
||||
LeftHandSkeletonRenderer = _leftHand.GetComponent<OVRSkeletonRenderer>();
|
||||
LeftHandMesh = _leftHand.GetComponent<OVRMesh>();
|
||||
LeftHandMeshRenderer = _leftHand.GetComponent<OVRMeshRenderer>();
|
||||
|
||||
RightHand = _rightHand.GetComponent<OVRHand>();
|
||||
RightHandSkeleton = _rightHand.GetComponent<OVRSkeleton>();
|
||||
RightHandSkeletonRenderer = _rightHand.GetComponent<OVRSkeletonRenderer>();
|
||||
RightHandMesh = _rightHand.GetComponent<OVRMesh>();
|
||||
RightHandMeshRenderer = _rightHand.GetComponent<OVRMeshRenderer>();
|
||||
_leftMeshRenderer = LeftHand.GetComponent<SkinnedMeshRenderer>();
|
||||
_rightMeshRenderer = RightHand.GetComponent<SkinnedMeshRenderer>();
|
||||
StartCoroutine(FindSkeletonVisualGameObjects());
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
switch (VisualMode)
|
||||
{
|
||||
case HandsVisualMode.Mesh:
|
||||
case HandsVisualMode.Skeleton:
|
||||
_currentHandAlpha = 1.0f;
|
||||
break;
|
||||
case HandsVisualMode.Both:
|
||||
_currentHandAlpha = 0.6f;
|
||||
break;
|
||||
default:
|
||||
_currentHandAlpha = 1.0f;
|
||||
break;
|
||||
}
|
||||
_rightMeshRenderer.sharedMaterial.SetFloat(HandAlphaId, _currentHandAlpha);
|
||||
_leftMeshRenderer.sharedMaterial.SetFloat(HandAlphaId, _currentHandAlpha);
|
||||
|
||||
UpdateFingerPinching(LeftHand, _pinchModeLeft, _lastPinchModeLeft);
|
||||
UpdateFingerPinching(RightHand, _pinchModeRight, _lastPinchModeRight);
|
||||
}
|
||||
|
||||
private IEnumerator FindSkeletonVisualGameObjects()
|
||||
{
|
||||
while (!_leftSkeletonVisual || !_rightSkeletonVisual)
|
||||
{
|
||||
if (!_leftSkeletonVisual)
|
||||
{
|
||||
Transform leftSkeletonVisualTransform = LeftHand.transform.Find(SKELETON_VISUALIZER_NAME);
|
||||
if (leftSkeletonVisualTransform)
|
||||
{
|
||||
_leftSkeletonVisual = leftSkeletonVisualTransform.gameObject;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_rightSkeletonVisual)
|
||||
{
|
||||
Transform rightSkeletonVisualTransform = RightHand.transform.Find(SKELETON_VISUALIZER_NAME);
|
||||
if (rightSkeletonVisualTransform)
|
||||
{
|
||||
_rightSkeletonVisual = rightSkeletonVisualTransform.gameObject;
|
||||
}
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
SetToCurrentVisualMode();
|
||||
}
|
||||
|
||||
public void SwitchVisualization()
|
||||
{
|
||||
if (!_leftSkeletonVisual || !_rightSkeletonVisual)
|
||||
{
|
||||
return;
|
||||
}
|
||||
VisualMode = (HandsVisualMode)(((int)VisualMode + 1) % ((int)HandsVisualMode.Both + 1));
|
||||
SetToCurrentVisualMode();
|
||||
}
|
||||
|
||||
private void SetToCurrentVisualMode()
|
||||
{
|
||||
switch (VisualMode)
|
||||
{
|
||||
case HandsVisualMode.Mesh:
|
||||
RightHandMeshRenderer.enabled = true;
|
||||
_rightMeshRenderer.enabled = true;
|
||||
_rightSkeletonVisual.gameObject.SetActive(false);
|
||||
LeftHandMeshRenderer.enabled = true;
|
||||
_leftMeshRenderer.enabled = true;
|
||||
_leftSkeletonVisual.gameObject.SetActive(false);
|
||||
break;
|
||||
case HandsVisualMode.Skeleton:
|
||||
RightHandMeshRenderer.enabled = false;
|
||||
_rightMeshRenderer.enabled = false;
|
||||
_rightSkeletonVisual.gameObject.SetActive(true);
|
||||
LeftHandMeshRenderer.enabled = false;
|
||||
_leftMeshRenderer.enabled = false;
|
||||
_leftSkeletonVisual.gameObject.SetActive(true);
|
||||
break;
|
||||
case HandsVisualMode.Both:
|
||||
RightHandMeshRenderer.enabled = true;
|
||||
_rightMeshRenderer.enabled = true;
|
||||
_rightSkeletonVisual.gameObject.SetActive(true);
|
||||
LeftHandMeshRenderer.enabled = true;
|
||||
_leftMeshRenderer.enabled = true;
|
||||
_leftSkeletonVisual.gameObject.SetActive(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<OVRBoneCapsule> GetCapsulesPerBone(OVRSkeleton skeleton, OVRSkeleton.BoneId boneId)
|
||||
{
|
||||
List<OVRBoneCapsule> boneCapsules = new List<OVRBoneCapsule>();
|
||||
var capsules = skeleton.Capsules;
|
||||
for (int i = 0; i < capsules.Count; ++i)
|
||||
{
|
||||
if (capsules[i].BoneIndex == (short)boneId)
|
||||
{
|
||||
boneCapsules.Add(capsules[i]);
|
||||
}
|
||||
}
|
||||
return boneCapsules;
|
||||
}
|
||||
|
||||
public PinchMode GetLeftPinchMode(OVRHand.HandFinger finger)
|
||||
{
|
||||
return _pinchModeLeft[(int)finger];
|
||||
}
|
||||
|
||||
public PinchMode GetRightPinchMode(OVRHand.HandFinger finger)
|
||||
{
|
||||
return _pinchModeRight[(int)finger];
|
||||
}
|
||||
|
||||
public PinchMode GetLastLeftPinchMode(OVRHand.HandFinger finger)
|
||||
{
|
||||
return _lastPinchModeLeft[(int)finger];
|
||||
}
|
||||
|
||||
public PinchMode GetLastRightPinchMode(OVRHand.HandFinger finger)
|
||||
{
|
||||
return _lastPinchModeRight[(int)finger];
|
||||
}
|
||||
|
||||
public bool IsInitialized()
|
||||
{
|
||||
return LeftHandSkeleton && LeftHandSkeleton.IsInitialized &&
|
||||
RightHandSkeleton && RightHandSkeleton.IsInitialized &&
|
||||
LeftHandMesh && LeftHandMesh.IsInitialized &&
|
||||
RightHandMesh && RightHandMesh.IsInitialized;
|
||||
}
|
||||
|
||||
static private bool IsFingerPinched(OVRHand hand, OVRHand.HandFinger finger)
|
||||
{
|
||||
return hand.GetFingerConfidence(finger) == OVRHand.TrackingConfidence.High && hand.GetFingerIsPinching(finger) && hand.GetFingerPinchStrength(finger) >= PinchMaxStrength;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates all fingers and updates pinching status. Also tracks last pinch status.
|
||||
/// </summary>
|
||||
/// <param name="hand"></param>
|
||||
/// <param name="pinchModes"></param>
|
||||
/// <param name="lastPinchModes"></param>
|
||||
private void UpdateFingerPinching(OVRHand hand, PinchMode[] pinchModes, PinchMode[] lastPinchModes)
|
||||
{
|
||||
for (int i = 0; i < pinchModes.Length; i++)
|
||||
{
|
||||
lastPinchModes[i] = pinchModes[i];
|
||||
pinchModes[i] = PinchMode.NotPinched;
|
||||
}
|
||||
|
||||
var isReliable = hand.IsTracked && hand.HandConfidence == OVRHand.TrackingConfidence.High;
|
||||
if (!isReliable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pinchModes[(int)OVRHand.HandFinger.Thumb] = IsFingerPinched(hand, OVRHand.HandFinger.Thumb) ? PinchMode.Pinched : PinchMode.NotPinched;
|
||||
pinchModes[(int)OVRHand.HandFinger.Index] = IsFingerPinched(hand, OVRHand.HandFinger.Index) ? PinchMode.Pinched : PinchMode.NotPinched;
|
||||
pinchModes[(int)OVRHand.HandFinger.Middle] = IsFingerPinched(hand, OVRHand.HandFinger.Middle) ? PinchMode.Pinched : PinchMode.NotPinched;
|
||||
pinchModes[(int)OVRHand.HandFinger.Ring] = IsFingerPinched(hand, OVRHand.HandFinger.Ring) ? PinchMode.Pinched : PinchMode.NotPinched;
|
||||
pinchModes[(int)OVRHand.HandFinger.Pinky] = IsFingerPinched(hand, OVRHand.HandFinger.Pinky) ? PinchMode.Pinched : PinchMode.NotPinched;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfae243ecd01edd49bd439c56a8b18cf
|
||||
timeCreated: 1468506975
|
||||
licenseType: Store
|
||||
guid: 355b24382fa1a9c4f8b72fd2095581f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
@@ -19,37 +19,137 @@ limitations under the License.
|
||||
|
||||
************************************************************************************/
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ControllerSelection {
|
||||
public class OVRInputHelpers {
|
||||
// Given a controller and tracking spcae, return the ray that controller uses.
|
||||
namespace ControllerSelection
|
||||
{
|
||||
public class OVRInputHelpers
|
||||
{
|
||||
public enum HandFilter
|
||||
{
|
||||
None = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Both = Left | Right
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether hand started pinching in this frame
|
||||
/// </summary>
|
||||
/// <param name="activeController"></param>
|
||||
/// <param name="finger"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsFingerStartPinching(OVRInput.Controller activeController, OVRHand.HandFinger finger)
|
||||
{
|
||||
bool isLeftHand = (activeController & OVRInput.Controller.LHand) == OVRInput.Controller.LHand;
|
||||
var curPinch = isLeftHand ? HandsManager.Instance.GetLeftPinchMode(finger) : HandsManager.Instance.GetRightPinchMode(finger);
|
||||
var lastPinch = isLeftHand ? HandsManager.Instance.GetLastLeftPinchMode(finger) : HandsManager.Instance.GetLastRightPinchMode(finger);
|
||||
|
||||
return (lastPinch == HandsManager.PinchMode.NotPinched && curPinch == HandsManager.PinchMode.Pinched);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether hand stopped pinching in this frame
|
||||
/// </summary>
|
||||
/// <param name="activeController"></param>
|
||||
/// <param name="finger"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsFingerStopPinching(OVRInput.Controller activeController, OVRHand.HandFinger finger)
|
||||
{
|
||||
bool isLeftHand = (activeController & OVRInput.Controller.LHand) == OVRInput.Controller.LHand;
|
||||
var curPinch = isLeftHand ? HandsManager.Instance.GetLeftPinchMode(finger) : HandsManager.Instance.GetRightPinchMode(finger);
|
||||
var lastPinch = isLeftHand ? HandsManager.Instance.GetLastLeftPinchMode(finger) : HandsManager.Instance.GetLastRightPinchMode(finger);
|
||||
|
||||
return (lastPinch == HandsManager.PinchMode.Pinched && curPinch == HandsManager.PinchMode.NotPinched);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether hand is pinching
|
||||
/// </summary>
|
||||
/// <param name="activeController"></param>
|
||||
/// <param name="finger"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsFingerPinching(OVRInput.Controller activeController, OVRHand.HandFinger finger)
|
||||
{
|
||||
bool isLeftHand = (activeController & OVRInput.Controller.LHand) == OVRInput.Controller.LHand;
|
||||
var curPinch = isLeftHand ? HandsManager.Instance.GetLeftPinchMode(finger) : HandsManager.Instance.GetRightPinchMode(finger);
|
||||
return (curPinch == HandsManager.PinchMode.Pinched);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns hand orientation
|
||||
/// </summary>
|
||||
/// <param name="factiveController"></param>
|
||||
/// <param name="orientation"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public static bool GetHandOrientation(OVRInput.Controller activeController, out Quaternion orientation, out Vector3 position)
|
||||
{
|
||||
orientation = default(Quaternion);
|
||||
position = default(Vector3);
|
||||
|
||||
if ((activeController & OVRInput.Controller.Hands) == OVRInput.Controller.None)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HandsManager.Instance || !HandsManager.Instance.IsInitialized())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var hand = (activeController & OVRInput.Controller.RHand) == OVRInput.Controller.RHand ? HandsManager.Instance.RightHand : HandsManager.Instance.LeftHand;
|
||||
var isReliable = hand.IsTracked && hand.HandConfidence == OVRHand.TrackingConfidence.High;
|
||||
if (!isReliable || !hand.IsPointerPoseValid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var pointer = hand.PointerPose;
|
||||
|
||||
orientation = pointer.rotation;
|
||||
position = pointer.position;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Given a controller and tracking space, return the ray that controller uses.
|
||||
// Will fall back to center eye or camera on Gear if no controller is present.
|
||||
public static Ray GetSelectionRay(OVRInput.Controller activeController, Transform trackingSpace) {
|
||||
if (trackingSpace != null && activeController != OVRInput.Controller.None) {
|
||||
Quaternion orientation = OVRInput.GetLocalControllerRotation(activeController);
|
||||
Vector3 localStartPoint = OVRInput.GetLocalControllerPosition(activeController);
|
||||
public static bool GetSelectionRay(OVRInput.Controller activeController, Transform trackingSpace, out Ray ray)
|
||||
{
|
||||
ray = default(Ray);
|
||||
if (trackingSpace != null && activeController != OVRInput.Controller.None)
|
||||
{
|
||||
Quaternion orientation = default(Quaternion);
|
||||
Vector3 localStartPoint = default(Vector3);
|
||||
|
||||
if ((activeController & OVRInput.Controller.Hands) != OVRInput.Controller.None)
|
||||
{
|
||||
if (!GetHandOrientation(activeController, out orientation, out localStartPoint))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
orientation = OVRInput.GetLocalControllerRotation(activeController);
|
||||
localStartPoint = OVRInput.GetLocalControllerPosition(activeController);
|
||||
}
|
||||
|
||||
Matrix4x4 localToWorld = trackingSpace.localToWorldMatrix;
|
||||
Vector3 worldStartPoint = localToWorld.MultiplyPoint(localStartPoint);
|
||||
Vector3 worldOrientation = localToWorld.MultiplyVector(orientation * Vector3.forward);
|
||||
|
||||
return new Ray(worldStartPoint, worldOrientation);
|
||||
ray = new Ray(worldStartPoint, worldOrientation);
|
||||
return true;
|
||||
}
|
||||
|
||||
Transform cameraTransform = Camera.main.transform;
|
||||
|
||||
if (OVRManager.instance != null) {
|
||||
OVRCameraRig cameraRig = OVRManager.instance.GetComponent<OVRCameraRig>();
|
||||
if (cameraRig != null) {
|
||||
cameraTransform = cameraRig.centerEyeAnchor;
|
||||
}
|
||||
}
|
||||
|
||||
return new Ray(cameraTransform.position, cameraTransform.forward);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Search the scene to find a tracking spce. This method can be expensive! Try to avoid it if possible.
|
||||
// Search the scene to find a tracking space. This method can be expensive! Try to avoid it if possible.
|
||||
public static Transform FindTrackingSpace() {
|
||||
// There should be an OVRManager in the scene
|
||||
if (OVRManager.instance != null) {
|
||||
@@ -82,39 +182,53 @@ namespace ControllerSelection {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find the current active controller, based on last time a certain button was hit. Needs to know the previous active controller.
|
||||
public static OVRInput.Controller GetControllerForButton(OVRInput.Button joyPadClickButton, OVRInput.Controller oldController) {
|
||||
/// <summary>
|
||||
/// Returns connected controllers
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
public static OVRInput.Controller GetConnectedControllers(HandFilter filter = HandFilter.Both)
|
||||
{
|
||||
OVRInput.Controller controller = OVRInput.GetConnectedControllers();
|
||||
|
||||
if ((controller & OVRInput.Controller.RTouch) == OVRInput.Controller.RTouch) {
|
||||
if (OVRInput.Get(joyPadClickButton, OVRInput.Controller.RTouch) || oldController == OVRInput.Controller.None) {
|
||||
return OVRInput.Controller.RTouch;
|
||||
if (((filter & HandFilter.Right) == HandFilter.Right) && (controller & OVRInput.Controller.RTouch) == OVRInput.Controller.RTouch)
|
||||
{
|
||||
return OVRInput.Controller.RTouch;
|
||||
}
|
||||
|
||||
if (((filter & HandFilter.Left) == HandFilter.Left) && (controller & OVRInput.Controller.LTouch) == OVRInput.Controller.LTouch)
|
||||
{
|
||||
return OVRInput.Controller.LTouch;
|
||||
}
|
||||
|
||||
if (((filter & HandFilter.Right) == HandFilter.Right) && (controller & OVRInput.Controller.RTrackedRemote) == OVRInput.Controller.RTrackedRemote)
|
||||
{
|
||||
return OVRInput.Controller.RTrackedRemote;
|
||||
}
|
||||
|
||||
if (((filter & HandFilter.Left) == HandFilter.Left) && (controller & OVRInput.Controller.LTrackedRemote) == OVRInput.Controller.LTrackedRemote)
|
||||
{
|
||||
return OVRInput.Controller.LTrackedRemote;
|
||||
}
|
||||
|
||||
controller = OVRInput.Controller.None;
|
||||
if (OVRPlugin.GetHandTrackingEnabled())
|
||||
{
|
||||
if ((filter & HandFilter.Both) == HandFilter.Both)
|
||||
{
|
||||
return OVRInput.Controller.Hands;
|
||||
}
|
||||
else if ((filter & HandFilter.Right) == HandFilter.Right)
|
||||
{
|
||||
return OVRInput.Controller.RHand;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OVRInput.Controller.LHand;
|
||||
}
|
||||
}
|
||||
|
||||
if ((controller & OVRInput.Controller.LTouch) == OVRInput.Controller.LTouch) {
|
||||
if (OVRInput.Get(joyPadClickButton, OVRInput.Controller.LTouch) || oldController == OVRInput.Controller.None) {
|
||||
return OVRInput.Controller.LTouch;
|
||||
}
|
||||
}
|
||||
|
||||
if ((controller & OVRInput.Controller.RTrackedRemote) == OVRInput.Controller.RTrackedRemote) {
|
||||
if (OVRInput.Get(joyPadClickButton, OVRInput.Controller.RTrackedRemote) || oldController == OVRInput.Controller.None) {
|
||||
return OVRInput.Controller.RTrackedRemote;
|
||||
}
|
||||
}
|
||||
|
||||
if ((controller & OVRInput.Controller.LTrackedRemote) == OVRInput.Controller.LTrackedRemote) {
|
||||
if (OVRInput.Get(joyPadClickButton, OVRInput.Controller.LTrackedRemote) || oldController == OVRInput.Controller.None) {
|
||||
return OVRInput.Controller.LTrackedRemote;
|
||||
}
|
||||
}
|
||||
|
||||
if ((controller & oldController) != oldController) {
|
||||
return OVRInput.Controller.None;
|
||||
}
|
||||
|
||||
return oldController;
|
||||
return OVRInput.Controller.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,14 @@ namespace ControllerSelection
|
||||
{
|
||||
public class OVRInputModule : UnityEngine.EventSystems.PointerInputModule
|
||||
{
|
||||
protected override void Awake() {
|
||||
public enum Hand
|
||||
{
|
||||
None,
|
||||
Left = OVRInputHelpers.HandFilter.Left,
|
||||
Right = OVRInputHelpers.HandFilter.Right
|
||||
}
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
if (trackingSpace == null) {
|
||||
Debug.LogWarning ("OVRInputModule did not have a tracking space set. Looking for one");
|
||||
@@ -65,6 +72,9 @@ namespace ControllerSelection
|
||||
[Tooltip("Primary selection button")]
|
||||
public OVRInput.Button joyPadClickButton = OVRInput.Button.PrimaryIndexTrigger;
|
||||
|
||||
[Tooltip("Primary hand pinch finger")]
|
||||
public OVRHand.HandFinger pinchFinger = OVRHand.HandFinger.Index;
|
||||
|
||||
[Header("Physics")]
|
||||
[Tooltip("Perform an sphere cast to determine correct depth for gaze pointer")]
|
||||
public bool performSphereCastForGazepointer;
|
||||
@@ -87,8 +97,7 @@ namespace ControllerSelection
|
||||
[Tooltip("Distance scrolled when swipe scroll occurs")]
|
||||
public float swipeScrollScale = 4f;
|
||||
|
||||
|
||||
[HideInInspector]
|
||||
[HideInInspector]
|
||||
public OVRInput.Controller activeController = OVRInput.Controller.None;
|
||||
|
||||
public delegate void RayHitDelegate(Vector3 hitPosition, Vector3 hitNormal);
|
||||
@@ -101,13 +110,15 @@ namespace ControllerSelection
|
||||
#endregion
|
||||
|
||||
// The raycaster that gets to do pointer interaction (e.g. with a mouse), gaze interaction always works
|
||||
// private OVRRaycaster _activeGraphicRaycaster;
|
||||
[NonSerialized]
|
||||
public OVRRaycaster activeGraphicRaycaster;
|
||||
[Header("Dragging")]
|
||||
[Tooltip("Minimum pointer movement in degrees to start dragging")]
|
||||
public float angleDragThreshold = 1;
|
||||
|
||||
[Tooltip("Suppress click while dragging")]
|
||||
public bool suppressClickOnDrag = true;
|
||||
|
||||
// The following region contains code exactly the same as the implementation
|
||||
// of StandaloneInputModule. It is copied here rather than inheriting from StandaloneInputModule
|
||||
// because most of StandaloneInputModule is private so it isn't possible to easily derive from.
|
||||
@@ -120,8 +131,8 @@ namespace ControllerSelection
|
||||
// ProcessMouseEvent
|
||||
// UseMouse
|
||||
#region StandaloneInputModule code
|
||||
|
||||
private float m_NextAction;
|
||||
|
||||
private float m_NextAction;
|
||||
|
||||
private Vector2 m_LastMousePosition;
|
||||
private Vector2 m_MousePosition;
|
||||
@@ -218,8 +229,6 @@ namespace ControllerSelection
|
||||
|
||||
public override void UpdateModule()
|
||||
{
|
||||
activeController = OVRInputHelpers.GetControllerForButton (OVRInput.Button.PrimaryIndexTrigger, activeController);
|
||||
|
||||
m_LastMousePosition = m_MousePosition;
|
||||
m_MousePosition = Input.mousePosition;
|
||||
}
|
||||
@@ -243,6 +252,7 @@ namespace ControllerSelection
|
||||
shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_VerticalAxis), 0.0f);
|
||||
shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f;
|
||||
shouldActivate |= Input.GetMouseButtonDown(0);
|
||||
|
||||
return shouldActivate;
|
||||
}
|
||||
|
||||
@@ -265,8 +275,6 @@ namespace ControllerSelection
|
||||
ClearSelection();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Process submit keys.
|
||||
/// </summary>
|
||||
@@ -337,10 +345,6 @@ namespace ControllerSelection
|
||||
return axisEventData.used;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private bool SendUpdateEventToSelectedObject()
|
||||
{
|
||||
if (eventSystem.currentSelectedGameObject == null)
|
||||
@@ -380,8 +384,6 @@ namespace ControllerSelection
|
||||
if (newPressed == null)
|
||||
newPressed = UnityEngine.EventSystems.ExecuteEvents.GetEventHandler<UnityEngine.EventSystems.IPointerClickHandler>(currentOverGo);
|
||||
|
||||
// Debug.Log("Pressed: " + newPressed);
|
||||
|
||||
float time = Time.unscaledTime;
|
||||
|
||||
if (newPressed == pointerEvent.lastPress)
|
||||
@@ -408,22 +410,25 @@ namespace ControllerSelection
|
||||
pointerEvent.pointerDrag = UnityEngine.EventSystems.ExecuteEvents.GetEventHandler<UnityEngine.EventSystems.IDragHandler>(currentOverGo);
|
||||
|
||||
if (pointerEvent.pointerDrag != null)
|
||||
{
|
||||
UnityEngine.EventSystems.ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, UnityEngine.EventSystems.ExecuteEvents.initializePotentialDrag);
|
||||
}
|
||||
}
|
||||
|
||||
// PointerUp notification
|
||||
if (data.ReleasedThisFrame())
|
||||
{
|
||||
// Debug.Log("Executing pressup on: " + pointer.pointerPress);
|
||||
UnityEngine.EventSystems.ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, UnityEngine.EventSystems.ExecuteEvents.pointerUpHandler);
|
||||
|
||||
// Debug.Log("KeyCode: " + pointer.eventData.keyCode);
|
||||
|
||||
// see if we mouse up on the same element that we clicked on...
|
||||
var pointerUpHandler = UnityEngine.EventSystems.ExecuteEvents.GetEventHandler<UnityEngine.EventSystems.IPointerClickHandler>(currentOverGo);
|
||||
|
||||
// Determine if we're dragging and if we want to suppress click while dragging
|
||||
var isDragging = pointerEvent.pointerDrag != null && pointerEvent.dragging;
|
||||
var suppressClick = suppressClickOnDrag && isDragging;
|
||||
|
||||
// PointerClick and Drop events
|
||||
if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
|
||||
if (!suppressClick && pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
|
||||
{
|
||||
UnityEngine.EventSystems.ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, UnityEngine.EventSystems.ExecuteEvents.pointerClickHandler);
|
||||
}
|
||||
@@ -436,8 +441,10 @@ namespace ControllerSelection
|
||||
pointerEvent.pointerPress = null;
|
||||
pointerEvent.rawPointerPress = null;
|
||||
|
||||
if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
|
||||
if (isDragging)
|
||||
{
|
||||
UnityEngine.EventSystems.ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, UnityEngine.EventSystems.ExecuteEvents.endDragHandler);
|
||||
}
|
||||
|
||||
pointerEvent.dragging = false;
|
||||
pointerEvent.pointerDrag = null;
|
||||
@@ -506,10 +513,8 @@ namespace ControllerSelection
|
||||
SendSubmitEventToSelectedObject();
|
||||
}
|
||||
|
||||
ProcessMouseEvent(GetGazePointerData());
|
||||
#if !UNITY_ANDROID
|
||||
ProcessMouseEvent(GetCanvasPointerData());
|
||||
#endif
|
||||
ProcessMouseEvent(GetGazePointerData(true));
|
||||
ProcessMouseEvent(GetGazePointerData(false));
|
||||
}
|
||||
/// <summary>
|
||||
/// Decide if mouse events need to be processed this frame. Same as StandloneInputModule except
|
||||
@@ -560,19 +565,20 @@ namespace ControllerSelection
|
||||
#region PointerEventData pool
|
||||
|
||||
// Pool for OVRRayPointerEventData for ray based pointers
|
||||
protected Dictionary<int, OVRRayPointerEventData> m_VRRayPointerData = new Dictionary<int, OVRRayPointerEventData>();
|
||||
protected Dictionary<int, OVRRayPointerEventData> m_VRRayPointerDataLeft = new Dictionary<int, OVRRayPointerEventData>();
|
||||
protected Dictionary<int, OVRRayPointerEventData> m_VRRayPointerDataRight = new Dictionary<int, OVRRayPointerEventData>();
|
||||
|
||||
|
||||
protected bool GetPointerData(int id, out OVRRayPointerEventData data, bool create)
|
||||
protected bool GetPointerData(int id, out OVRRayPointerEventData data, bool create, bool isLeft)
|
||||
{
|
||||
if (!m_VRRayPointerData.TryGetValue(id, out data) && create)
|
||||
var rayPointerData = isLeft ? m_VRRayPointerDataLeft : m_VRRayPointerDataRight;
|
||||
if (!rayPointerData.TryGetValue(id, out data) && create)
|
||||
{
|
||||
data = new OVRRayPointerEventData(eventSystem)
|
||||
{
|
||||
pointerId = id,
|
||||
};
|
||||
|
||||
m_VRRayPointerData.Add(id, data);
|
||||
rayPointerData.Add(id, data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -590,7 +596,12 @@ namespace ControllerSelection
|
||||
// clear all selection
|
||||
HandlePointerExitAndEnter(pointer, null);
|
||||
}
|
||||
foreach (var pointer in m_VRRayPointerData.Values)
|
||||
foreach (var pointer in m_VRRayPointerDataLeft.Values)
|
||||
{
|
||||
// clear all selection
|
||||
HandlePointerExitAndEnter(pointer, null);
|
||||
}
|
||||
foreach (var pointer in m_VRRayPointerDataRight.Values)
|
||||
{
|
||||
// clear all selection
|
||||
HandlePointerExitAndEnter(pointer, null);
|
||||
@@ -614,26 +625,28 @@ namespace ControllerSelection
|
||||
return Vector3.Cross(LeftEdge, BottomEdge).normalized;
|
||||
}
|
||||
|
||||
private readonly MouseState m_MouseState = new MouseState();
|
||||
// Overridden so that we can process the two types of pointer separately
|
||||
private readonly MouseState m_MouseStateLeft = new MouseState();
|
||||
private readonly MouseState m_MouseStateRight = new MouseState();
|
||||
|
||||
// Overridden so that we can process the two types of pointer separately
|
||||
|
||||
// The following 2 functions are equivalent to PointerInputModule.GetMousePointerEventData but are customized to
|
||||
// get data for ray pointers and canvas mouse pointers.
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// State for a pointer controlled by a world space ray. E.g. gaze pointer
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected MouseState GetGazePointerData()
|
||||
protected MouseState GetGazePointerData(bool isLeft)
|
||||
{
|
||||
// Get the OVRRayPointerEventData reference
|
||||
OVRRayPointerEventData leftData;
|
||||
GetPointerData(kMouseLeftId, out leftData, true );
|
||||
GetPointerData(kMouseLeftId, out leftData, true, isLeft);
|
||||
leftData.Reset();
|
||||
|
||||
|
||||
leftData.worldSpaceRay = OVRInputHelpers.GetSelectionRay(activeController, trackingSpace);
|
||||
leftData.worldSpaceRay = default(Ray);
|
||||
var activeController = OVRInputHelpers.GetConnectedControllers(isLeft ? OVRInputHelpers.HandFilter.Left : OVRInputHelpers.HandFilter.Right);
|
||||
bool gotRay = OVRInputHelpers.GetSelectionRay(activeController, trackingSpace, out leftData.worldSpaceRay);
|
||||
leftData.scrollDelta = GetExtraScrollDelta();
|
||||
|
||||
//Populate some default values
|
||||
@@ -654,7 +667,6 @@ namespace ControllerSelection
|
||||
// space position for the camera attached to this raycaster for compatability
|
||||
leftData.position = ovrRaycaster.GetScreenPosition(raycast);
|
||||
|
||||
|
||||
// Find the world position and normal the Graphic the ray intersected
|
||||
RectTransform graphicRect = raycast.gameObject.GetComponent<RectTransform>();
|
||||
if (graphicRect != null)
|
||||
@@ -682,75 +694,21 @@ namespace ControllerSelection
|
||||
|
||||
// copy the apropriate data into right and middle slots
|
||||
OVRRayPointerEventData rightData;
|
||||
GetPointerData(kMouseRightId, out rightData, true );
|
||||
GetPointerData(kMouseRightId, out rightData, true, isLeft);
|
||||
CopyFromTo(leftData, rightData);
|
||||
rightData.button = UnityEngine.EventSystems.PointerEventData.InputButton.Right;
|
||||
|
||||
OVRRayPointerEventData middleData;
|
||||
GetPointerData(kMouseMiddleId, out middleData, true );
|
||||
GetPointerData(kMouseMiddleId, out middleData, true, isLeft);
|
||||
CopyFromTo(leftData, middleData);
|
||||
middleData.button = UnityEngine.EventSystems.PointerEventData.InputButton.Middle;
|
||||
|
||||
var mouseState = isLeft ? m_MouseStateLeft : m_MouseStateRight;
|
||||
|
||||
m_MouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Left, GetGazeButtonState(), leftData);
|
||||
m_MouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Right, UnityEngine.EventSystems.PointerEventData.FramePressState.NotChanged, rightData);
|
||||
m_MouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Middle, UnityEngine.EventSystems.PointerEventData.FramePressState.NotChanged, middleData);
|
||||
return m_MouseState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get state for pointer which is a pointer moving in world space across the surface of a world space canvas.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected MouseState GetCanvasPointerData()
|
||||
{
|
||||
// Get the OVRRayPointerEventData reference
|
||||
UnityEngine.EventSystems.PointerEventData leftData;
|
||||
GetPointerData(kMouseLeftId, out leftData, true );
|
||||
leftData.Reset();
|
||||
|
||||
// Setup default values here. Set position to zero because we don't actually know the pointer
|
||||
// positions. Each canvas knows the position of its canvas pointer.
|
||||
leftData.position = Vector2.zero;
|
||||
leftData.scrollDelta = Input.mouseScrollDelta;
|
||||
leftData.button = UnityEngine.EventSystems.PointerEventData.InputButton.Left;
|
||||
|
||||
if (activeGraphicRaycaster)
|
||||
{
|
||||
// Let the active raycaster find intersections on its canvas
|
||||
activeGraphicRaycaster.RaycastPointer(leftData, m_RaycastResultCache);
|
||||
var raycast = FindFirstRaycast(m_RaycastResultCache);
|
||||
leftData.pointerCurrentRaycast = raycast;
|
||||
m_RaycastResultCache.Clear();
|
||||
|
||||
OVRRaycaster ovrRaycaster = raycast.module as OVRRaycaster;
|
||||
if (ovrRaycaster) // raycast may not actually contain a result
|
||||
{
|
||||
// The Unity UI system expects event data to have a screen position
|
||||
// so even though this raycast came from a world space ray we must get a screen
|
||||
// space position for the camera attached to this raycaster for compatability
|
||||
Vector2 position = ovrRaycaster.GetScreenPosition(raycast);
|
||||
|
||||
leftData.delta = position - leftData.position;
|
||||
leftData.position = position;
|
||||
}
|
||||
}
|
||||
|
||||
// copy the apropriate data into right and middle slots
|
||||
UnityEngine.EventSystems.PointerEventData rightData;
|
||||
GetPointerData(kMouseRightId, out rightData, true );
|
||||
CopyFromTo(leftData, rightData);
|
||||
rightData.button = UnityEngine.EventSystems.PointerEventData.InputButton.Right;
|
||||
|
||||
UnityEngine.EventSystems.PointerEventData middleData;
|
||||
GetPointerData(kMouseMiddleId, out middleData, true );
|
||||
CopyFromTo(leftData, middleData);
|
||||
middleData.button = UnityEngine.EventSystems.PointerEventData.InputButton.Middle;
|
||||
|
||||
m_MouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Left, StateForMouseButton(0), leftData);
|
||||
m_MouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Right, StateForMouseButton(1), rightData);
|
||||
m_MouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Middle, StateForMouseButton(2), middleData);
|
||||
return m_MouseState;
|
||||
mouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Left, GetGazeButtonState(activeController), leftData);
|
||||
mouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Right, UnityEngine.EventSystems.PointerEventData.FramePressState.NotChanged, rightData);
|
||||
mouseState.SetButtonState(UnityEngine.EventSystems.PointerEventData.InputButton.Middle, UnityEngine.EventSystems.PointerEventData.FramePressState.NotChanged, middleData);
|
||||
return mouseState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -840,16 +798,27 @@ namespace ControllerSelection
|
||||
/// Get state of button corresponding to gaze pointer
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected UnityEngine.EventSystems.PointerEventData.FramePressState GetGazeButtonState()
|
||||
protected UnityEngine.EventSystems.PointerEventData.FramePressState GetGazeButtonState(OVRInput.Controller activeController)
|
||||
{
|
||||
var pressed = false;
|
||||
var released = false;
|
||||
|
||||
if (activeController != OVRInput.Controller.None) {
|
||||
pressed = OVRInput.GetDown(joyPadClickButton, activeController);
|
||||
released = OVRInput.GetUp(joyPadClickButton, activeController);
|
||||
if ((activeController & OVRInput.Controller.Touch) != OVRInput.Controller.None)
|
||||
{
|
||||
// Handle touch controllers
|
||||
pressed = OVRInput.GetDown(joyPadClickButton, activeController);
|
||||
released = OVRInput.GetUp(joyPadClickButton, activeController);
|
||||
}
|
||||
else if ((activeController & OVRInput.Controller.Hands) != OVRInput.Controller.None &&
|
||||
OVRPlugin.GetHandTrackingEnabled() && null != HandsManager.Instance && HandsManager.Instance.IsInitialized())
|
||||
{
|
||||
pressed = OVRInputHelpers.IsFingerStartPinching(activeController, pinchFinger);
|
||||
released = OVRInputHelpers.IsFingerStopPinching(activeController, pinchFinger);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
pressed = OVRInput.GetDown(joyPadClickButton);
|
||||
released = OVRInput.GetUp(joyPadClickButton);
|
||||
}
|
||||
@@ -860,16 +829,13 @@ namespace ControllerSelection
|
||||
#endif
|
||||
|
||||
if (pressed && released) {
|
||||
//Debug.Log ("pressed & released");
|
||||
return UnityEngine.EventSystems.PointerEventData.FramePressState.PressedAndReleased;
|
||||
}
|
||||
if (pressed) {
|
||||
//Debug.Log ("pressed");
|
||||
return UnityEngine.EventSystems.PointerEventData.FramePressState.Pressed;
|
||||
return UnityEngine.EventSystems.PointerEventData.FramePressState.Pressed;
|
||||
}
|
||||
if (released) {
|
||||
//Debug.Log ("released");
|
||||
return UnityEngine.EventSystems.PointerEventData.FramePressState.Released;
|
||||
return UnityEngine.EventSystems.PointerEventData.FramePressState.Released;
|
||||
}
|
||||
|
||||
return UnityEngine.EventSystems.PointerEventData.FramePressState.NotChanged;
|
||||
|
||||
@@ -23,7 +23,15 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
namespace ControllerSelection {
|
||||
|
||||
public class OVRPointerVisualizer : MonoBehaviour {
|
||||
public class OVRPointerVisualizer : MonoBehaviour
|
||||
{
|
||||
public enum Hand
|
||||
{
|
||||
None,
|
||||
Left = OVRInputHelpers.HandFilter.Left,
|
||||
Right = OVRInputHelpers.HandFilter.Right
|
||||
}
|
||||
|
||||
[Header("(Optional) Tracking space")]
|
||||
[Tooltip("Tracking space of the OVRCameraRig.\nIf tracking space is not set, the scene will be searched.\nThis search is expensive.")]
|
||||
public Transform trackingSpace = null;
|
||||
@@ -38,36 +46,42 @@ namespace ControllerSelection {
|
||||
public float gazeDrawDistance = 3;
|
||||
[Tooltip("Show gaze pointer as ray pointer.")]
|
||||
public bool showRayPointer = true;
|
||||
[Tooltip("Left or Right hand / controller")]
|
||||
public Hand handType = Hand.None;
|
||||
|
||||
// Start ray draw distance
|
||||
private const float StartRayDrawDistance = 0.032f;
|
||||
|
||||
[HideInInspector]
|
||||
public OVRInput.Controller activeController = OVRInput.Controller.None;
|
||||
|
||||
void Awake() {
|
||||
if (trackingSpace == null) {
|
||||
void Awake()
|
||||
{
|
||||
if (trackingSpace == null)
|
||||
{
|
||||
Debug.LogWarning("OVRPointerVisualizer did not have a tracking space set. Looking for one");
|
||||
trackingSpace = OVRInputHelpers.FindTrackingSpace();
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
void OnEnable()
|
||||
{
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnDisable() {
|
||||
void OnDisable()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
|
||||
if (trackingSpace == null) {
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
if (trackingSpace == null)
|
||||
{
|
||||
Debug.LogWarning("OVRPointerVisualizer did not have a tracking space set. Looking for one");
|
||||
trackingSpace = OVRInputHelpers.FindTrackingSpace();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPointer(Ray ray) {
|
||||
void SetPointer(Ray ray)
|
||||
{
|
||||
float hitRayDrawDistance = rayDrawDistance;
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit))
|
||||
@@ -75,40 +89,54 @@ namespace ControllerSelection {
|
||||
hitRayDrawDistance = hit.distance;
|
||||
}
|
||||
|
||||
if (linePointer != null) {
|
||||
if (linePointer != null)
|
||||
{
|
||||
linePointer.SetPosition(0, ray.origin + ray.direction * StartRayDrawDistance);
|
||||
linePointer.SetPosition(1, ray.origin + ray.direction * hitRayDrawDistance);
|
||||
}
|
||||
|
||||
if (gazePointer != null) {
|
||||
if (gazePointer != null)
|
||||
{
|
||||
gazePointer.position = ray.origin + ray.direction * (showRayPointer ? hitRayDrawDistance : gazeDrawDistance);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPointerVisibility() {
|
||||
if (trackingSpace != null && activeController != OVRInput.Controller.None) {
|
||||
if (linePointer != null) {
|
||||
void SetPointerVisibility(bool show)
|
||||
{
|
||||
if (show) {
|
||||
if (linePointer != null)
|
||||
{
|
||||
linePointer.enabled = true;
|
||||
}
|
||||
if (gazePointer != null) {
|
||||
if (gazePointer != null)
|
||||
{
|
||||
gazePointer.gameObject.SetActive(showRayPointer ? true : false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (linePointer != null) {
|
||||
if (linePointer != null)
|
||||
{
|
||||
linePointer.enabled = false;
|
||||
}
|
||||
if (gazePointer != null) {
|
||||
if (gazePointer != null)
|
||||
{
|
||||
gazePointer.gameObject.SetActive(showRayPointer ? false : true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
activeController = OVRInputHelpers.GetControllerForButton(OVRInput.Button.PrimaryIndexTrigger, activeController);
|
||||
Ray selectionRay = OVRInputHelpers.GetSelectionRay(activeController, trackingSpace);
|
||||
SetPointerVisibility();
|
||||
SetPointer(selectionRay);
|
||||
void Update()
|
||||
{
|
||||
var activeController = OVRInputHelpers.GetConnectedControllers((OVRInputHelpers.HandFilter)handType);
|
||||
|
||||
Ray selectionRay;
|
||||
bool gotRay = OVRInputHelpers.GetSelectionRay(activeController, trackingSpace, out selectionRay);
|
||||
SetPointerVisibility(gotRay && trackingSpace != null && activeController != OVRInput.Controller.None);
|
||||
|
||||
if (gotRay)
|
||||
{
|
||||
SetPointer(selectionRay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,25 @@ limitations under the License.
|
||||
|
||||
************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Permissions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace ControllerSelection {
|
||||
public class OVRRawRaycaster : MonoBehaviour {
|
||||
namespace ControllerSelection
|
||||
{
|
||||
public class OVRRawRaycaster : MonoBehaviour, IBeginDragHandler, IEndDragHandler
|
||||
{
|
||||
public enum Hand
|
||||
{
|
||||
None,
|
||||
Left = OVRInputHelpers.HandFilter.Left,
|
||||
Right = OVRInputHelpers.HandFilter.Right
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class HoverCallback : UnityEvent<Transform> { }
|
||||
[System.Serializable]
|
||||
@@ -34,7 +47,6 @@ namespace ControllerSelection {
|
||||
[Tooltip("Tracking space of the OVRCameraRig.\nIf tracking space is not set, the scene will be searched.\nThis search is expensive.")]
|
||||
public Transform trackingSpace = null;
|
||||
|
||||
|
||||
[Header("Selection")]
|
||||
[Tooltip("Primary selection button")]
|
||||
public OVRInput.Button primaryButton = OVRInput.Button.PrimaryIndexTrigger;
|
||||
@@ -42,6 +54,12 @@ namespace ControllerSelection {
|
||||
public OVRInput.Button secondaryButton = OVRInput.Button.PrimaryTouchpad;
|
||||
[Tooltip("Tertiary selection button")]
|
||||
public OVRInput.Button tertiaryButton = OVRInput.Button.One;
|
||||
[Tooltip("Primary pinch finger")]
|
||||
public OVRHand.HandFinger primaryPinchFinger = OVRHand.HandFinger.Index;
|
||||
[Tooltip("Secondary pinch finger")]
|
||||
public OVRHand.HandFinger secondaryPinchFinger = OVRHand.HandFinger.Middle;
|
||||
[Tooltip("Tertiary pinch finger")]
|
||||
public OVRHand.HandFinger tertiaryPinchFinger = OVRHand.HandFinger.Ring;
|
||||
[Tooltip("Layers to exclude from raycast")]
|
||||
public LayerMask excludeLayers;
|
||||
[Tooltip("Maximum raycast distance")]
|
||||
@@ -58,137 +76,338 @@ namespace ControllerSelection {
|
||||
public OVRRawRaycaster.SelectionCallback onTertiarySelect;
|
||||
|
||||
//protected Ray pointer;
|
||||
protected Transform lastHit = null;
|
||||
protected Transform triggerDown = null;
|
||||
protected Transform padDown = null;
|
||||
protected Transform tertiaryDown = null;
|
||||
protected Transform lastHitLeft = null;
|
||||
protected Transform lastHitRight = null;
|
||||
protected Transform lastButtonHitLeft = null;
|
||||
protected Transform lastButtonHitRight = null;
|
||||
protected Transform triggerButtonDownLeft = null;
|
||||
protected Transform triggerButtonDownRight = null;
|
||||
protected Transform padButtonDownLeft = null;
|
||||
protected Transform padButtonDownRight = null;
|
||||
protected Transform tertiaryButtonDownLeft = null;
|
||||
protected Transform tertiaryButtonDownRight = null;
|
||||
protected Transform triggerFingerDownLeft = null;
|
||||
protected Transform triggerFingerDownRight = null;
|
||||
protected Transform padFingerDownLeft = null;
|
||||
protected Transform padFingerDownRight = null;
|
||||
protected Transform tertiaryFingerDownLeft = null;
|
||||
protected Transform tertiaryFingerDownRight = null;
|
||||
|
||||
[HideInInspector]
|
||||
public OVRInput.Controller activeController = OVRInput.Controller.None;
|
||||
// Hover actions
|
||||
[Flags]
|
||||
enum HoverAction
|
||||
{
|
||||
None = 0,
|
||||
Exit = 1,
|
||||
Enter = 2,
|
||||
Stay = 4,
|
||||
Hover = 8
|
||||
}
|
||||
|
||||
void Awake() {
|
||||
if (trackingSpace == null) {
|
||||
// Map of transform to hover actions. We allocate this once & reuse to avoid memory allocations in Update().
|
||||
Dictionary<Transform, HoverAction> _actions = new Dictionary<Transform, HoverAction>(4);
|
||||
|
||||
// Whether we're dragging
|
||||
bool _isDragging = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (trackingSpace == null)
|
||||
{
|
||||
Debug.LogWarning("OVRRawRaycaster did not have a tracking space set. Looking for one");
|
||||
trackingSpace = OVRInputHelpers.FindTrackingSpace();
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
void OnEnable()
|
||||
{
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnDisable() {
|
||||
void OnDisable()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
|
||||
if (trackingSpace == null) {
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
if (trackingSpace == null)
|
||||
{
|
||||
Debug.LogWarning("OVRRawRaycaster did not have a tracking space set. Looking for one");
|
||||
trackingSpace = OVRInputHelpers.FindTrackingSpace();
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
activeController = OVRInputHelpers.GetControllerForButton(OVRInput.Button.PrimaryIndexTrigger, activeController);
|
||||
Ray pointer = OVRInputHelpers.GetSelectionRay(activeController, trackingSpace);
|
||||
public void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
_isDragging = true;
|
||||
}
|
||||
|
||||
RaycastHit hit; // Was anything hit?
|
||||
if (Physics.Raycast(pointer, out hit, raycastDistance, ~excludeLayers)) {
|
||||
if (lastHit != null && lastHit != hit.transform) {
|
||||
if (onHoverExit != null) {
|
||||
onHoverExit.Invoke(lastHit);
|
||||
}
|
||||
lastHit = null;
|
||||
}
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
_isDragging = false;
|
||||
}
|
||||
|
||||
if (lastHit == null) {
|
||||
if (onHoverEnter != null) {
|
||||
onHoverEnter.Invoke(hit.transform);
|
||||
}
|
||||
}
|
||||
|
||||
if (onHover != null) {
|
||||
onHover.Invoke(hit.transform);
|
||||
}
|
||||
|
||||
lastHit = hit.transform;
|
||||
|
||||
// Handle selection callbacks. An object is selected if the button selecting it was
|
||||
// pressed AND released while hovering over the object.
|
||||
if (activeController != OVRInput.Controller.None) {
|
||||
if (OVRInput.GetDown(tertiaryButton, activeController))
|
||||
static void ProcessHit(Dictionary<Transform, HoverAction> actions, bool isHit, Transform hit, ref Transform lastHit)
|
||||
{
|
||||
if (isHit)
|
||||
{
|
||||
if (lastHit != null)
|
||||
{
|
||||
if (lastHit != hit)
|
||||
{
|
||||
tertiaryDown = lastHit;
|
||||
// We move out of the last hit, so action is Exit
|
||||
actions[lastHit] |= HoverAction.Exit;
|
||||
lastHit = null;
|
||||
}
|
||||
else if (OVRInput.GetUp(tertiaryButton, activeController))
|
||||
else
|
||||
{
|
||||
if (tertiaryDown != null && tertiaryDown == lastHit)
|
||||
{
|
||||
if (onTertiarySelect != null)
|
||||
{
|
||||
onTertiarySelect.Invoke(tertiaryDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!OVRInput.Get(tertiaryButton, activeController))
|
||||
{
|
||||
tertiaryDown = null;
|
||||
// We have not moved from last hit, so action is Stay
|
||||
actions[lastHit] |= HoverAction.Stay;
|
||||
}
|
||||
}
|
||||
|
||||
if (OVRInput.GetDown(secondaryButton, activeController)) {
|
||||
padDown = lastHit;
|
||||
}
|
||||
else if (OVRInput.GetUp(secondaryButton, activeController)) {
|
||||
if (padDown != null && padDown == lastHit) {
|
||||
if (onSecondarySelect != null) {
|
||||
onSecondarySelect.Invoke(padDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!OVRInput.Get(secondaryButton, activeController)) {
|
||||
padDown = null;
|
||||
}
|
||||
if (lastHit == null)
|
||||
{
|
||||
// We moved into a new hit, so action is Enter
|
||||
actions[hit] |= HoverAction.Enter;
|
||||
}
|
||||
|
||||
if (OVRInput.GetDown(primaryButton, activeController)) {
|
||||
triggerDown = lastHit;
|
||||
}
|
||||
else if (OVRInput.GetUp(primaryButton, activeController)) {
|
||||
if (triggerDown != null && triggerDown == lastHit) {
|
||||
if (onPrimarySelect != null) {
|
||||
onPrimarySelect.Invoke(triggerDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!OVRInput.Get(primaryButton, activeController)) {
|
||||
triggerDown = null;
|
||||
}
|
||||
}
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
// Gaze pointer fallback
|
||||
else {
|
||||
if (Input.GetMouseButtonDown(0) ) {
|
||||
triggerDown = lastHit;
|
||||
}
|
||||
else if (Input.GetMouseButtonUp(0) ) {
|
||||
if (triggerDown != null && triggerDown == lastHit) {
|
||||
if (onPrimarySelect != null) {
|
||||
onPrimarySelect.Invoke(triggerDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Input.GetMouseButton(0)) {
|
||||
triggerDown = null;
|
||||
}
|
||||
// We hit something, so action is hover
|
||||
actions[hit] |= HoverAction.Hover;
|
||||
lastHit = hit;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// Nothing was hit, handle exit callback
|
||||
else if (lastHit != null) {
|
||||
if (onHoverExit != null) {
|
||||
onHoverExit.Invoke(lastHit);
|
||||
}
|
||||
else if (lastHit != null)
|
||||
{
|
||||
// Nothing was hit, handle exit callback
|
||||
actions[lastHit] |= HoverAction.Exit;
|
||||
lastHit = null;
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessButtonPresses(OVRInput.Controller activeController, bool isLeft, Transform lastHit,
|
||||
ref Transform triggerDown, ref Transform padDown, ref Transform tertiaryDown)
|
||||
{
|
||||
// Handle selection callbacks. An object is selected if the button selecting it was
|
||||
// pressed AND released while hovering over the object.
|
||||
if (isLeft && (activeController & OVRInput.Controller.LTouch) != OVRInput.Controller.LTouch ||
|
||||
!isLeft && (activeController & OVRInput.Controller.RTouch) != OVRInput.Controller.RTouch)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OVRInput.GetDown(tertiaryButton, activeController))
|
||||
{
|
||||
tertiaryDown = lastHit;
|
||||
}
|
||||
else if (OVRInput.GetUp(tertiaryButton, activeController))
|
||||
{
|
||||
if (tertiaryDown != null && tertiaryDown == lastHit)
|
||||
{
|
||||
if (onTertiarySelect != null)
|
||||
{
|
||||
onTertiarySelect.Invoke(tertiaryDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!OVRInput.Get(tertiaryButton, activeController))
|
||||
{
|
||||
tertiaryDown = null;
|
||||
}
|
||||
|
||||
if (OVRInput.GetDown(secondaryButton, activeController))
|
||||
{
|
||||
padDown = lastHit;
|
||||
}
|
||||
else if (OVRInput.GetUp(secondaryButton, activeController))
|
||||
{
|
||||
if (padDown != null && padDown == lastHit)
|
||||
{
|
||||
if (onSecondarySelect != null)
|
||||
{
|
||||
onSecondarySelect.Invoke(padDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!OVRInput.Get(secondaryButton, activeController))
|
||||
{
|
||||
padDown = null;
|
||||
}
|
||||
|
||||
if (OVRInput.GetDown(primaryButton, activeController))
|
||||
{
|
||||
triggerDown = lastHit;
|
||||
}
|
||||
else if (OVRInput.GetUp(primaryButton, activeController))
|
||||
{
|
||||
if (triggerDown != null && triggerDown == lastHit)
|
||||
{
|
||||
if (onPrimarySelect != null)
|
||||
{
|
||||
onPrimarySelect.Invoke(triggerDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!OVRInput.Get(primaryButton, activeController))
|
||||
{
|
||||
triggerDown = null;
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessHandPinch(OVRInput.Controller activeController, Transform lastHit,
|
||||
ref Transform triggerDown, ref Transform padDown, ref Transform tertiaryDown)
|
||||
{
|
||||
// Handle selection callbacks. An object is selected if the button selecting it was
|
||||
// pressed AND released while hovering over the object.
|
||||
if ((activeController & OVRInput.Controller.Hands) == OVRInput.Controller.None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!OVRPlugin.GetHandTrackingEnabled() || !HandsManager.Instance || !HandsManager.Instance.IsInitialized())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OVRInputHelpers.IsFingerStartPinching(activeController, tertiaryPinchFinger))
|
||||
{
|
||||
tertiaryDown = lastHit;
|
||||
}
|
||||
else if (OVRInputHelpers.IsFingerStopPinching(activeController, tertiaryPinchFinger))
|
||||
{
|
||||
if (tertiaryDown != null && tertiaryDown == lastHit)
|
||||
{
|
||||
if (onTertiarySelect != null)
|
||||
{
|
||||
onTertiarySelect.Invoke(tertiaryDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!OVRInputHelpers.IsFingerPinching(activeController, tertiaryPinchFinger))
|
||||
{
|
||||
tertiaryDown = null;
|
||||
}
|
||||
|
||||
if (OVRInputHelpers.IsFingerStartPinching(activeController, secondaryPinchFinger))
|
||||
{
|
||||
padDown = lastHit;
|
||||
}
|
||||
else if (OVRInputHelpers.IsFingerStopPinching(activeController, secondaryPinchFinger))
|
||||
{
|
||||
if (padDown != null && padDown == lastHit)
|
||||
{
|
||||
if (onSecondarySelect != null)
|
||||
{
|
||||
onSecondarySelect.Invoke(padDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!OVRInputHelpers.IsFingerPinching(activeController, secondaryPinchFinger))
|
||||
{
|
||||
padDown = null;
|
||||
}
|
||||
|
||||
if (OVRInputHelpers.IsFingerStartPinching(activeController, primaryPinchFinger))
|
||||
{
|
||||
triggerDown = lastHit;
|
||||
}
|
||||
else if (OVRInputHelpers.IsFingerStopPinching(activeController, primaryPinchFinger))
|
||||
{
|
||||
if (triggerDown != null && triggerDown == lastHit)
|
||||
{
|
||||
if (onPrimarySelect != null)
|
||||
{
|
||||
onPrimarySelect.Invoke(triggerDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!OVRInputHelpers.IsFingerPinching(activeController, primaryPinchFinger))
|
||||
{
|
||||
triggerDown = null;
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
Ray pointerLeft;
|
||||
Ray pointerRight;
|
||||
|
||||
// Get left & right rays
|
||||
var activeControllerLeft = OVRInputHelpers.GetConnectedControllers(OVRInputHelpers.HandFilter.Left);
|
||||
var activeControllerRight = OVRInputHelpers.GetConnectedControllers(OVRInputHelpers.HandFilter.Right);
|
||||
|
||||
bool gotRayLeft = OVRInputHelpers.GetSelectionRay(activeControllerLeft, trackingSpace, out pointerLeft);
|
||||
bool gotRayRight = OVRInputHelpers.GetSelectionRay(activeControllerRight, trackingSpace, out pointerRight);
|
||||
|
||||
// Cast the rays
|
||||
RaycastHit hitLeft = default(RaycastHit);
|
||||
RaycastHit hitRight = default(RaycastHit);
|
||||
bool isHitLeft = gotRayLeft && Physics.Raycast(pointerLeft, out hitLeft, raycastDistance, ~excludeLayers);
|
||||
bool isHitRight = gotRayRight && Physics.Raycast(pointerRight, out hitRight, raycastDistance, ~excludeLayers);
|
||||
|
||||
// Process the hits
|
||||
_actions.Clear();
|
||||
|
||||
if (lastHitLeft != null)
|
||||
{
|
||||
_actions[lastHitLeft] = HoverAction.None;
|
||||
}
|
||||
|
||||
if (lastHitRight != null)
|
||||
{
|
||||
_actions[lastHitRight] = HoverAction.None;
|
||||
}
|
||||
|
||||
if (isHitLeft)
|
||||
{
|
||||
_actions[hitLeft.transform] = HoverAction.None;
|
||||
}
|
||||
|
||||
if (isHitRight)
|
||||
{
|
||||
_actions[hitRight.transform] = HoverAction.None;
|
||||
}
|
||||
|
||||
ProcessHit(_actions, isHitLeft, hitLeft.transform, ref lastHitLeft);
|
||||
ProcessHit(_actions, isHitRight, hitRight.transform, ref lastHitRight);
|
||||
|
||||
// Perform the actions
|
||||
foreach (KeyValuePair<Transform, HoverAction> kvp in _actions)
|
||||
{
|
||||
// Only perform enter / exit actions if we are not staying on existing transform
|
||||
// and if we're not both entering & exiting
|
||||
if ((kvp.Value & HoverAction.Stay) == HoverAction.None &&
|
||||
(kvp.Value & (HoverAction.Enter | HoverAction.Exit)) != (HoverAction.Enter | HoverAction.Exit))
|
||||
{
|
||||
if ((kvp.Value & HoverAction.Enter) != HoverAction.None && onHoverEnter != null)
|
||||
{
|
||||
onHoverEnter.Invoke(kvp.Key);
|
||||
}
|
||||
|
||||
if ((kvp.Value & HoverAction.Exit) != HoverAction.None && onHoverExit != null)
|
||||
{
|
||||
onHoverExit.Invoke(kvp.Key);
|
||||
}
|
||||
}
|
||||
|
||||
if ((kvp.Value & HoverAction.Hover) != HoverAction.None && onHover != null)
|
||||
{
|
||||
// Hovering over transform
|
||||
onHover.Invoke(kvp.Key);
|
||||
}
|
||||
}
|
||||
|
||||
if (isHitLeft && !_isDragging)
|
||||
{
|
||||
ProcessButtonPresses(activeControllerLeft, true, lastHitLeft, ref triggerButtonDownLeft, ref padButtonDownLeft, ref tertiaryButtonDownLeft);
|
||||
ProcessHandPinch(activeControllerLeft, lastHitLeft, ref triggerFingerDownLeft, ref padFingerDownLeft, ref tertiaryFingerDownLeft);
|
||||
}
|
||||
|
||||
if (isHitRight && !_isDragging)
|
||||
{
|
||||
ProcessButtonPresses(activeControllerRight, false, lastHitRight, ref triggerButtonDownRight, ref padButtonDownRight, ref tertiaryButtonDownRight);
|
||||
ProcessHandPinch(activeControllerRight, lastHitRight, ref triggerFingerDownRight, ref padFingerDownRight, ref tertiaryFingerDownRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fa47351daf7f431a99d1bfc2294193d
|
||||
guid: 3701e8c189047bd4e846e85a926beca3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 485ac48a563e2bf44bb4de7ead5a1f68
|
||||
timeCreated: 1461716881
|
||||
licenseType: Store
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3994560fb567c34a821fd9355c10eef
|
||||
timeCreated: 1461716882
|
||||
licenseType: Store
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7000b4d67a1320940b363f3cf891dfff
|
||||
timeCreated: 1461716881
|
||||
licenseType: Store
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8198ccc08475a764daaf226b841a55f1
|
||||
timeCreated: 1461716882
|
||||
licenseType: Store
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,36 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace OVR
|
||||
{
|
||||
|
||||
public class TestScript : MonoBehaviour {
|
||||
|
||||
[InspectorNote( "Sound Setup", "Press '1' to play testSound1 and '2' to play testSound2")]
|
||||
|
||||
public SoundFXRef testSound1;
|
||||
public SoundFXRef testSound2;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update ()
|
||||
{
|
||||
// use attached game object location
|
||||
if ( Input.GetKeyDown( KeyCode.Alpha1 ) )
|
||||
{
|
||||
testSound1.PlaySoundAt( transform.position );
|
||||
}
|
||||
|
||||
// hard code information
|
||||
if ( Input.GetKeyDown( KeyCode.Alpha2 ) ) {
|
||||
testSound2.PlaySoundAt( new Vector3( 5.0f, 0.0f, 0.0f ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OVR
|
||||
@@ -1,437 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 8
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_TemporalCoherenceThreshold: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 0
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 9
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_TextureWidth: 1024
|
||||
m_TextureHeight: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 0
|
||||
m_CompAOExponentDirect: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 1
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ShowResolutionOverlay: 1
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 0
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &767466533
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 767466535}
|
||||
- component: {fileID: 767466534}
|
||||
m_Layer: 0
|
||||
m_Name: AudioManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &767466534
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 767466533}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6d1d30b41806244fca035fdae2896fb7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
makePersistent: 1
|
||||
enableSpatializedAudio: 1
|
||||
enableSpatializedFastOverride: 0
|
||||
audioMixer: {fileID: 0}
|
||||
defaultMixerGroup: {fileID: 24300001, guid: 323417d454569d94fa01d511f6eb44d9, type: 2}
|
||||
reservedMixerGroup: {fileID: 0}
|
||||
voiceChatMixerGroup: {fileID: 0}
|
||||
verboseLogging: 0
|
||||
maxSoundEmitters: 32
|
||||
volumeSoundFX: 1
|
||||
soundFxFadeSecs: 1
|
||||
audioMinFallOffDistance: 1
|
||||
audioMaxFallOffDistance: 25
|
||||
soundGroupings:
|
||||
- name: Test Group
|
||||
soundList:
|
||||
- name: TestSound1
|
||||
playback: 0
|
||||
volume: 1
|
||||
pitchVariance: {x: 0.95, y: 1.05}
|
||||
falloffDistance: {x: 1, y: 25}
|
||||
falloffCurve: 2
|
||||
volumeFalloffCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 1.0044228
|
||||
inSlope: -1.9459304
|
||||
outSlope: -1.9459304
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 0.27001944
|
||||
value: 0.24837627
|
||||
inSlope: -1.3226271
|
||||
outSlope: -1.3226271
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 0.99744946
|
||||
value: -0.0020017216
|
||||
inSlope: -0.42040923
|
||||
outSlope: -0.42040923
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 0
|
||||
reverbZoneMix:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 1.0044228
|
||||
inSlope: -1.9459304
|
||||
outSlope: -1.9459304
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 0.36357749
|
||||
value: 0.4567863
|
||||
inSlope: -1.3226271
|
||||
outSlope: -1.3226271
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 0.99594045
|
||||
value: 0.19572063
|
||||
inSlope: -0.107312
|
||||
outSlope: -0.107312
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 0
|
||||
spread: 0
|
||||
pctChanceToPlay: 1
|
||||
priority: 0
|
||||
delay: {x: 0, y: 0}
|
||||
looping: 0
|
||||
ospProps:
|
||||
enableSpatialization: 1
|
||||
useFastOverride: 1
|
||||
gain: 0
|
||||
enableInvSquare: 1
|
||||
volumetric: 0
|
||||
invSquareFalloff: {x: 1, y: 250}
|
||||
soundClips:
|
||||
- {fileID: 8300000, guid: 7000b4d67a1320940b363f3cf891dfff, type: 3}
|
||||
- {fileID: 8300000, guid: 8198ccc08475a764daaf226b841a55f1, type: 3}
|
||||
visibilityToggle: 0
|
||||
- name: TestSound2
|
||||
playback: 0
|
||||
volume: 1
|
||||
pitchVariance: {x: 0.79999995, y: 1.25}
|
||||
falloffDistance: {x: 1, y: 25}
|
||||
falloffCurve: 1
|
||||
volumeFalloffCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMix:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spread: 0
|
||||
pctChanceToPlay: 1
|
||||
priority: 0
|
||||
delay: {x: 0, y: 0}
|
||||
looping: 0
|
||||
ospProps:
|
||||
enableSpatialization: 1
|
||||
useFastOverride: 0
|
||||
gain: 0
|
||||
enableInvSquare: 0
|
||||
volumetric: 0
|
||||
invSquareFalloff: {x: 1, y: 25}
|
||||
soundClips:
|
||||
- {fileID: 8300000, guid: 485ac48a563e2bf44bb4de7ead5a1f68, type: 3}
|
||||
- {fileID: 8300000, guid: d3994560fb567c34a821fd9355c10eef, type: 3}
|
||||
visibilityToggle: 0
|
||||
mixerGroup: {fileID: 24300001, guid: 1dd706bb85d8aef4e83a6229dbd62c36, type: 2}
|
||||
maxPlayingSounds: 0
|
||||
preloadAudio: 0
|
||||
volumeOverride: 1
|
||||
playingSoundCount: 0
|
||||
--- !u!4 &767466535
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 767466533}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1050355579
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1050355581}
|
||||
- component: {fileID: 1050355580}
|
||||
m_Layer: 0
|
||||
m_Name: TestScript
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1050355580
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1050355579}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cfae243ecd01edd49bd439c56a8b18cf, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
testSound1:
|
||||
soundFXName: TestSound1
|
||||
testSound2:
|
||||
soundFXName: TestSound2
|
||||
--- !u!4 &1050355581
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1050355579}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2106254871
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 2106254876}
|
||||
- component: {fileID: 2106254875}
|
||||
- component: {fileID: 2106254874}
|
||||
- component: {fileID: 2106254873}
|
||||
- component: {fileID: 2106254872}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &2106254872
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 2106254871}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &2106254873
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 2106254871}
|
||||
m_Enabled: 1
|
||||
--- !u!92 &2106254874
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 2106254871}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &2106254875
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 2106254871}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 0
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &2106254876
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 2106254871}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 600e5d49b0a68254286400e32c53addc
|
||||
timeCreated: 1468506358
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -13,3 +13,8 @@ MonoBehaviour:
|
||||
m_Name: OculusProjectConfig
|
||||
m_EditorClassIdentifier:
|
||||
targetDeviceTypes: 01000000
|
||||
handTrackingSupport: 1
|
||||
colorGamut: 0
|
||||
disableBackups: 1
|
||||
enableNSCConfig: 1
|
||||
focusAware: 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fcf81388fa09c62499146010792af088
|
||||
guid: 10ace22946bbe714a9fce09f84fd47b3
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d24accc358524cd6aaf38cf6f4d077b
|
||||
guid: 5d96358144d2ac9469bb51ecc2285f27
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abd4679034662fa4382b6c0e2933ed6f
|
||||
guid: 4e678f02c24ca7d45add6932bfe529b9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "Oculus.Platform.Editor",
|
||||
"references": [
|
||||
"Oculus.Platform"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.xr.management",
|
||||
"expression": "",
|
||||
"define": "USING_XR_MANAGEMENT"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.xr.oculus",
|
||||
"expression": "",
|
||||
"define": "USING_XR_SDK_OCULUS"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39cfe7aa0a2d46c47994d8d0308ec663
|
||||
DefaultImporter:
|
||||
guid: ae177491a94151a4899094505be41938
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -1,3 +1,7 @@
|
||||
#if USING_XR_MANAGEMENT && USING_XR_SDK_OCULUS
|
||||
#define USING_XR_SDK
|
||||
#endif
|
||||
|
||||
namespace Oculus.Platform
|
||||
{
|
||||
using System;
|
||||
@@ -161,16 +165,19 @@ namespace Oculus.Platform
|
||||
if (isBuildSettingsExpanded)
|
||||
{
|
||||
GUIHelper.HInset(6, () => {
|
||||
#if !USING_XR_SDK
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
EditorGUILayout.HelpBox("The Oculus XR Plugin isn't enabled from XR Plugin Management in Project Settings", MessageType.Warning);
|
||||
#else
|
||||
if (!PlayerSettings.virtualRealitySupported)
|
||||
{
|
||||
EditorGUILayout.HelpBox("VR Support isn't enabled in the Player Settings", MessageType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox("VR Support is enabled", MessageType.Info);
|
||||
}
|
||||
|
||||
PlayerSettings.virtualRealitySupported = MakeToggle(new GUIContent("Virtual Reality Support"), PlayerSettings.virtualRealitySupported);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PlayerSettings.bundleVersion = MakeTextBox(new GUIContent("Bundle Version"), PlayerSettings.bundleVersion);
|
||||
#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5
|
||||
PlayerSettings.bundleIdentifier = MakeTextBox(new GUIContent("Bundle Identifier"), PlayerSettings.bundleIdentifier);
|
||||
@@ -276,8 +283,8 @@ namespace Oculus.Platform
|
||||
|
||||
public enum PluginPlatform
|
||||
{
|
||||
Android32,
|
||||
Android64
|
||||
Android32,
|
||||
Android64
|
||||
}
|
||||
|
||||
private static string GetCurrentProjectPath()
|
||||
@@ -318,8 +325,8 @@ namespace Oculus.Platform
|
||||
//[UnityEditor.MenuItem("Oculus/Platform/EnforcePluginPlatformSettings")]
|
||||
public static void EnforcePluginPlatformSettings()
|
||||
{
|
||||
EnforcePluginPlatformSettings(PluginPlatform.Android32);
|
||||
EnforcePluginPlatformSettings(PluginPlatform.Android64);
|
||||
EnforcePluginPlatformSettings(PluginPlatform.Android32);
|
||||
EnforcePluginPlatformSettings(PluginPlatform.Android64);
|
||||
}
|
||||
|
||||
public static void EnforcePluginPlatformSettings(PluginPlatform platform)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Oculus.Platform",
|
||||
"references": [],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.xr.management",
|
||||
"expression": "",
|
||||
"define": "USING_XR_MANAGEMENT"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.xr.oculus",
|
||||
"expression": "",
|
||||
"define": "USING_XR_SDK_OCULUS"
|
||||
}
|
||||
]
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c884d076d6398b54492bcc64bbe30bf5
|
||||
DefaultImporter:
|
||||
guid: 8c01d52dc9e9c7c41b509ed43aa1d098
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 965e22ff2df788844b460ddb38b52c63
|
||||
guid: 4ceb3cc2da1c38048ba9123f908c33f9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5ade4ea912d1024b98a2aae1edd8d4b
|
||||
guid: d16a4c02095db1245a50b1de0d5bcdf6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71f62bfe84bf80d48b4aecade2b18710
|
||||
guid: 18fb0e7057360374fa820eece0d5d112
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 421b5471317fd4e4e8dad62ea665d4c5
|
||||
guid: 724a505b68ecac443bc477eeb986e34f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,34 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe7ed02a4d2df5143a972d37d7af94b4
|
||||
timeCreated: 1555100492
|
||||
licenseType: Store
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
'': data
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: ARM64
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e5d140cbf7f1b64188a4a891384c5c9
|
||||
guid: 456b08f21cd27084d92a877dbf2b9ee5
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd19ab760a88d4147bb139e1772b30bf
|
||||
guid: eddc37f131931d64a862552274d9cf4f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3dce8f6f8cd6f3b4a99ef7e0708fbe76
|
||||
guid: 6547d763bf83228429a4d12428194804
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c62fefb060a105469849eefc4530f73
|
||||
guid: 14f341254c04db042bf0039bf9a08821
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f615547c377c15c4ea2a0e37bca038c5
|
||||
guid: d0c0677176bd3cb4c92d3da1c0c50508
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e95fb942c82302a43978166bf0efaf71
|
||||
guid: 0431403efe8137c4d88bcef2b0c6e0d8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 309928a3f1f643b48be6839db352c2ac
|
||||
guid: 410f24c4266efe34985820a13cac86ce
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -943,6 +943,16 @@ namespace Oculus.Platform
|
||||
[DllImport(DLL_NAME, CallingConvention=CallingConvention.Cdecl, EntryPoint="ovr_Leaderboard_GetEntriesAfterRank")]
|
||||
private static extern ulong ovr_Leaderboard_GetEntriesAfterRank_Native(IntPtr leaderboardName, int limit, ulong afterRank);
|
||||
|
||||
public static ulong ovr_Leaderboard_GetEntriesByIds(string leaderboardName, int limit, LeaderboardStartAt startAt, UInt64[] userIDs, uint userIDLength) {
|
||||
IntPtr leaderboardName_native = StringToNative(leaderboardName);
|
||||
var result = (ovr_Leaderboard_GetEntriesByIds_Native(leaderboardName_native, limit, startAt, userIDs, userIDLength));
|
||||
Marshal.FreeCoTaskMem(leaderboardName_native);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(DLL_NAME, CallingConvention=CallingConvention.Cdecl, EntryPoint="ovr_Leaderboard_GetEntriesByIds")]
|
||||
private static extern ulong ovr_Leaderboard_GetEntriesByIds_Native(IntPtr leaderboardName, int limit, LeaderboardStartAt startAt, UInt64[] userIDs, uint userIDLength);
|
||||
|
||||
[DllImport(DLL_NAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
public static extern ulong ovr_Leaderboard_GetNextEntries(IntPtr handle);
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace Oculus.Platform
|
||||
[Description("UNKNOWN")]
|
||||
Unknown,
|
||||
|
||||
[Description("USER_IDS")]
|
||||
UserIds,
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace Oculus.Platform
|
||||
LanguagePack_SetCurrent = 0x5B4FBBE0,
|
||||
Leaderboard_GetEntries = 0x5DB3474C,
|
||||
Leaderboard_GetEntriesAfterRank = 0x18378BEF,
|
||||
Leaderboard_GetEntriesByIds = 0x39607BFC,
|
||||
Leaderboard_GetNextEntries = 0x4E207CD9,
|
||||
Leaderboard_GetPreviousEntries = 0x4901DAC0,
|
||||
Leaderboard_WriteEntry = 0x117FC8FE,
|
||||
@@ -483,6 +484,7 @@ namespace Oculus.Platform
|
||||
|
||||
case Message.MessageType.Leaderboard_GetEntries:
|
||||
case Message.MessageType.Leaderboard_GetEntriesAfterRank:
|
||||
case Message.MessageType.Leaderboard_GetEntriesByIds:
|
||||
case Message.MessageType.Leaderboard_GetNextEntries:
|
||||
case Message.MessageType.Leaderboard_GetPreviousEntries:
|
||||
message = new MessageWithLeaderboardEntryList(messageHandle);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37f4ad0cb40aa574ebd6f2b0ce8a090c
|
||||
guid: 5c34ec78fb8218d4086a6dec4acc4a2c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6584aafbe36b05f479abff629d533b56
|
||||
guid: ebbae1565298c9f428c5d96f362d06ab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 999d2ec5f273d594d8e9c093998863a4
|
||||
guid: 021def392a7307c4a950a32b1f73f00e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf2d6ecb34cf35843877cc075b9f17d1
|
||||
guid: 0ee57f638fd886546bfe5aa2316a8d5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b74702841edb5cc48aa485d83b36ef53
|
||||
guid: b141b04a9242dae4da12d2683e4811e7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cc45eb009ae2c446869ed02f106f0d4
|
||||
guid: 0b9cc57b6344c564bb11f4ca56f08386
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c601026d7ea002640b7e4b84b835abd3
|
||||
guid: 0718d02a322b48142b1e78ecce538848
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad5a1937689b9ff4896a9dcf9c558190
|
||||
guid: 06673c5a5c4d6bc4484abdb4adfebc26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 174b536e224d5b84282c6d103da9c81a
|
||||
guid: ac77b89c30c104d41976fa9364ab87f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea0e9a160bcaee043ac1440054b38a92
|
||||
guid: 65f225aade97b5b43a58c1a30f40c229
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 104977abd9cf64c4c963c4e67b8dbe55
|
||||
guid: 28d59554b5e6ce94793295ce54af14ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45db1970b90587042b5482b011269eb9
|
||||
guid: 21315400743b3414aa3d9e7517a93d6d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd5f6a5bf683b3e4a90b349e68f71116
|
||||
guid: 325d0224e7aea0740be07d6c6c73101b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50daa3e06daf33d418c6fa31920e590c
|
||||
guid: 71eb8470c05652e4a94ba8fbc7ca17e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81b3c8cffe3331140a62df154d710f2d
|
||||
guid: ef0fea52eb00cec459f6961c574f0335
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1147,7 +1147,7 @@ namespace Oculus.Platform
|
||||
|
||||
public static partial class Leaderboards
|
||||
{
|
||||
/// Requests a block of Leaderboard Entries.
|
||||
/// Requests a block of leaderboard entries.
|
||||
/// \param leaderboardName The name of the leaderboard whose entries to return.
|
||||
/// \param limit Defines the maximum number of entries to return.
|
||||
/// \param filter Allows you to restrict the returned values by friends.
|
||||
@@ -1166,7 +1166,7 @@ namespace Oculus.Platform
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Requests a block of leaderboard Entries.
|
||||
/// Requests a block of leaderboard entries.
|
||||
/// \param leaderboardName The name of the leaderboard.
|
||||
/// \param limit The maximum number of entries to return.
|
||||
/// \param afterRank The position after which to start. For example, 10 returns leaderboard results starting with the 11th user.
|
||||
@@ -1181,6 +1181,23 @@ namespace Oculus.Platform
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Requests a block of leaderboard entries. Will return only entries matching
|
||||
/// the user IDs passed in.
|
||||
/// \param leaderboardName The name of the leaderboard whose entries to return.
|
||||
/// \param limit Defines the maximum number of entries to return.
|
||||
/// \param startAt Defines whether to center the query on the user or start at the top of the leaderboard. If this is LeaderboardStartAt.CenteredOnViewer or LeaderboardStartAt.CenteredOnViewerOrTop, then the current user's ID will be automatically added to the query.
|
||||
/// \param userIDs Defines a list of user ids to get entries for.
|
||||
///
|
||||
public static Request<Models.LeaderboardEntryList> GetEntriesByIds(string leaderboardName, int limit, LeaderboardStartAt startAt, UInt64[] userIDs)
|
||||
{
|
||||
if (Core.IsInitialized())
|
||||
{
|
||||
return new Request<Models.LeaderboardEntryList>(CAPI.ovr_Leaderboard_GetEntriesByIds(leaderboardName, limit, startAt, userIDs, (uint)(userIDs != null ? userIDs.Length : 0)));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Writes a single entry to a leaderboard.
|
||||
/// \param leaderboardName The leaderboard for which to write the entry.
|
||||
/// \param score The score to write.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 507bd7426f1b9ef4c8971a42896e48ad
|
||||
guid: ddde54b747ea4fa42a8a9f66bad7d790
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddb3d806d2db34d448029105984a5cb0
|
||||
guid: 386aad0a25d6ca240922fb0cec4ee80a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b3df845616a14c4680b472abaaf9a88
|
||||
guid: a306302dc08b052499ca37975fd2f27b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c208be5612326e84d9ab05e3db1e7577
|
||||
guid: 482a4441200812a45b95c10203da3945
|
||||
folderAsset: yes
|
||||
timeCreated: 1560372287
|
||||
timeCreated: 1587079908
|
||||
licenseType: Store
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 456a020a4fcb4be41a4e69895514765e
|
||||
guid: 6f842a6dd1a0d17459eee1c804aa7e1b
|
||||
folderAsset: yes
|
||||
timeCreated: 1560372287
|
||||
timeCreated: 1587079908
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
|
||||
+3
-3
@@ -15,17 +15,17 @@
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>1.47.0</string>
|
||||
<string>1.48.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string></string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.47.0</string>
|
||||
<string>1.48.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.47.0</string>
|
||||
<string>1.48.0</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c68b32ff0b6f9594da6b369e3029c626
|
||||
timeCreated: 1584968029
|
||||
guid: c76f915af578f004cbba304c0968b3c9
|
||||
timeCreated: 1587079909
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8963e0bd5b2352048ba7c380b3ec48e5
|
||||
guid: f565deebb829abf419adbc9e40fd896a
|
||||
folderAsset: yes
|
||||
timeCreated: 1560372287
|
||||
timeCreated: 1587079909
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
|
||||
BIN
Binary file not shown.
+2
-2
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1856ac0a07518f14cb7f7a5effb2edba
|
||||
timeCreated: 1584968029
|
||||
guid: 77716eac5f114614ab5cd7dbe9d1f29e
|
||||
timeCreated: 1587079909
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0639115b7dbafc459a7265b5523077d
|
||||
guid: d02373d93b4b79e41af291b26708f322
|
||||
folderAsset: yes
|
||||
timeCreated: 1425156097
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e72a6c3e73efa646898d748ab8d230d
|
||||
guid: 2110d36298c920d41bb38b2c4a49e2b4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
Binary file not shown.
@@ -1,98 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c44ae4e55ac2fc84d9a159d9da9187e7
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 1
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
- first:
|
||||
'': Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude LinuxUniversal: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 0
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Linux
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: LinuxUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXIntel
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXIntel64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c7dc205605b42042975b528f57d109d
|
||||
guid: 08cfceeb8a0af76409eaeb6bbd906e6d
|
||||
folderAsset: yes
|
||||
timeCreated: 1425156097
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f879d616488d58642b9e6551294edb95
|
||||
guid: 3c5db0898f7e5514d8c970e5ad173f34
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
Binary file not shown.
@@ -1,98 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 455beaad753df474989066032533be77
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 1
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
- first:
|
||||
'': Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude LinuxUniversal: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Standalone: LinuxUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXIntel
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXIntel64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f7f4173a5d8ed444b8fba9e8e086826
|
||||
timeCreated: 1584968032
|
||||
guid: 04af4d701ed82b842aa38a8234356364
|
||||
timeCreated: 1587079911
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 583c546491355d8449225b66c5e5e5f5
|
||||
timeCreated: 1584968032
|
||||
guid: d53b5f22c937b8544909d42dd8c18b84
|
||||
timeCreated: 1587079912
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d90e72edf016940118ffe806231b1d87
|
||||
guid: 16c5809e1b015fc45b9024316c9f0b8a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d716392289ac6764994885f5821f7d7b
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -215,6 +215,7 @@ partial class OculusBuildApp : EditorWindow
|
||||
|
||||
if (!CheckADBDevices())
|
||||
{
|
||||
buildFailed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -230,18 +231,27 @@ partial class OculusBuildApp : EditorWindow
|
||||
SetupDirectories();
|
||||
|
||||
// 1. Get scenes to build in Unity, and export gradle project
|
||||
List<string> sceneList = GetScenesToBuild();
|
||||
DateTime unityExportStart = DateTime.Now;
|
||||
var buildResult = BuildPipeline.BuildPlayer(sceneList.ToArray(), gradleTempExport, BuildTarget.Android,
|
||||
BuildOptions.AcceptExternalModificationsToPlayer |
|
||||
BuildOptions.Development |
|
||||
BuildOptions.AllowDebugging);
|
||||
var buildResult = UnityBuildPlayer();
|
||||
|
||||
if (buildResult.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
{
|
||||
double unityExportTime = (DateTime.Now - unityExportStart).TotalSeconds;
|
||||
OVRPlugin.SendEvent("build_step_unity_export", unityExportTime.ToString(), "ovrbuild");
|
||||
totalBuildTime += unityExportTime;
|
||||
foreach (var step in buildResult.steps)
|
||||
{
|
||||
// Only log top level build steps & specific nested steps to reduce the number of events sent
|
||||
if (step.depth == 1 ||
|
||||
(step.name.StartsWith("Packaging assets") && step.name.EndsWith(".assets")) ||
|
||||
step.name.Equals("Managed Stripping: (Mono)") ||
|
||||
step.name.Equals("Splitting assets") ||
|
||||
step.name.Equals("IL2CPP") ||
|
||||
step.name.Equals("Exporting project")
|
||||
)
|
||||
{
|
||||
OVRPlugin.SendEvent($"build_step_unity_build_player {step.name}", step.duration.TotalSeconds.ToString(), "ovrbuild");
|
||||
}
|
||||
}
|
||||
|
||||
OVRPlugin.SendEvent("build_step_unity_export", buildResult.summary.totalTime.TotalSeconds.ToString(), "ovrbuild");
|
||||
totalBuildTime += buildResult.summary.totalTime.TotalSeconds;
|
||||
|
||||
// Set static variables so build thread has updated data
|
||||
showCancel = true;
|
||||
@@ -274,7 +284,47 @@ partial class OculusBuildApp : EditorWindow
|
||||
buildFailed = true;
|
||||
}
|
||||
|
||||
static void OVRBuildRun()
|
||||
private static UnityEditor.Build.Reporting.BuildReport UnityBuildPlayer()
|
||||
{
|
||||
var sceneList = GetScenesToBuild();
|
||||
var buildPlayerOptions = new BuildPlayerOptions
|
||||
{
|
||||
scenes = sceneList.ToArray(),
|
||||
locationPathName = gradleTempExport,
|
||||
target = BuildTarget.Android,
|
||||
options = BuildOptions.AcceptExternalModificationsToPlayer |
|
||||
BuildOptions.Development |
|
||||
BuildOptions.AllowDebugging
|
||||
};
|
||||
|
||||
var buildResult = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
|
||||
UnityEngine.Debug.Log(UnityBuildPlayerSummary(buildResult));
|
||||
|
||||
return buildResult;
|
||||
}
|
||||
|
||||
private static string UnityBuildPlayerSummary(UnityEditor.Build.Reporting.BuildReport report)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder();
|
||||
|
||||
sb.Append($"Unity Build Player: Build {report.summary.result} ({report.summary.totalSize} bytes) in {report.summary.totalTime.TotalSeconds:0.00}s");
|
||||
|
||||
foreach (var step in report.steps)
|
||||
{
|
||||
sb.AppendLine();
|
||||
if (step.depth > 0)
|
||||
{
|
||||
sb.Append(new String('-', step.depth));
|
||||
sb.Append(' ');
|
||||
}
|
||||
sb.Append($"{step.name}: {step.duration:g}");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static void OVRBuildRun()
|
||||
{
|
||||
// 2. Process gradle project
|
||||
IncrementProgressBar("Processing gradle project . . .");
|
||||
@@ -299,7 +349,7 @@ partial class OculusBuildApp : EditorWindow
|
||||
{
|
||||
gradleBuildProcess = new Process();
|
||||
string arguments = "-Xmx4096m -classpath \"" + gradlePath +
|
||||
"\" org.gradle.launcher.GradleMain assembleDebug -x validateSigningDebug";
|
||||
"\" org.gradle.launcher.GradleMain assembleDebug -x validateSigningDebug --profile";
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var gradleProjectPath = gradleExport;
|
||||
#else
|
||||
@@ -336,7 +386,8 @@ partial class OculusBuildApp : EditorWindow
|
||||
(s, e) =>
|
||||
{
|
||||
if (e != null && e.Data != null &&
|
||||
e.Data.Length != 0 && e.Data.Contains("BUILD"))
|
||||
e.Data.Length != 0 &&
|
||||
(e.Data.Contains("BUILD") || e.Data.StartsWith("See the profiling report at:")))
|
||||
{
|
||||
UnityEngine.Debug.LogFormat("Gradle: {0}", e.Data);
|
||||
if (e.Data.Contains("SUCCESSFUL"))
|
||||
|
||||
@@ -68,8 +68,16 @@ public class OVRBundleManager
|
||||
DateTime apkBuildStart = DateTime.Now;
|
||||
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
BuildReport report = BuildPipeline.BuildPlayer(buildScenes, apkOutputPath, BuildTarget.Android,
|
||||
BuildOptions.Development | BuildOptions.AutoRunPlayer);
|
||||
var buildPlayerOptions = new BuildPlayerOptions
|
||||
{
|
||||
scenes = buildScenes,
|
||||
locationPathName = apkOutputPath,
|
||||
target = BuildTarget.Android,
|
||||
options = BuildOptions.Development |
|
||||
BuildOptions.AutoRunPlayer
|
||||
};
|
||||
|
||||
BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
|
||||
if (report.summary.result == BuildResult.Succeeded)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ public class OVRConfig : ScriptableObject
|
||||
{
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
// Check for use of embedded path or user defined
|
||||
bool useEmbedded = EditorPrefs.GetBool("SdkUseEmbedded");
|
||||
bool useEmbedded = EditorPrefs.GetBool("SdkUseEmbedded") || string.IsNullOrEmpty(EditorPrefs.GetString("AndroidSdkRoot"));
|
||||
if (useEmbedded)
|
||||
{
|
||||
androidSDKPath = Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None), "SDK");
|
||||
@@ -94,7 +94,7 @@ public class OVRConfig : ScriptableObject
|
||||
string libPath = "";
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
// Check for use of embedded path or user defined
|
||||
bool useEmbedded = EditorPrefs.GetBool("GradleUseEmbedded");
|
||||
bool useEmbedded = EditorPrefs.GetBool("GradleUseEmbedded") || string.IsNullOrEmpty(EditorPrefs.GetString("GradlePath"));
|
||||
|
||||
if (useEmbedded)
|
||||
{
|
||||
@@ -139,7 +139,7 @@ public class OVRConfig : ScriptableObject
|
||||
{
|
||||
#if UNITY_EDITOR_WIN
|
||||
// Check for use of embedded path or user defined
|
||||
bool useEmbedded = EditorPrefs.GetBool("JdkUseEmbedded");
|
||||
bool useEmbedded = EditorPrefs.GetBool("JdkUseEmbedded") || string.IsNullOrEmpty(EditorPrefs.GetString("JdkPath"));
|
||||
|
||||
string exePath = "";
|
||||
if (useEmbedded)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user