Initialer Upload neues Unity-Projekt
This commit is contained in:
9
Assets/SteamVR/InteractionSystem/Core/Icons.meta
Normal file
9
Assets/SteamVR/InteractionSystem/Core/Icons.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fcf8377413b60c44afff7b2e4efd8f7
|
||||
folderAsset: yes
|
||||
timeCreated: 1482867667
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,59 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b93fe5c516cf6ed4b9153ec790f856e2
|
||||
timeCreated: 1484264198
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 032fb1710098a1d47ad34d72e90f714a
|
||||
timeCreated: 1435940722
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27f3faef5a63db84c9cbac06e94ab7b3
|
||||
timeCreated: 1435940722
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6789d499b24f8964c8bb06e21008e546
|
||||
timeCreated: 1435940722
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1acda2a2584a8fb4683ea56799b27fa0
|
||||
timeCreated: 1435940722
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90173f9e9e795f74ca97ccc52fe410cd
|
||||
timeCreated: 1435940723
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77b322b27d7d39f4d91e479d19065d50
|
||||
timeCreated: 1435940723
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/SteamVR/InteractionSystem/Core/Materials.meta
Normal file
9
Assets/SteamVR/InteractionSystem/Core/Materials.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05a69997deb9f5944a894239434f00a9
|
||||
folderAsset: yes
|
||||
timeCreated: 1479762244
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,138 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: FallbackHandIndicator
|
||||
m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 2000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
data:
|
||||
first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
data:
|
||||
first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Cutoff
|
||||
second: .5
|
||||
data:
|
||||
first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _Glossiness
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _Parallax
|
||||
second: .0199999996
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
m_Colors:
|
||||
data:
|
||||
first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 0, b: 0, a: 1}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e995e61de69d8647ae2b2d65eceab3f
|
||||
timeCreated: 1436394722
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,182 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: HoverHighlight
|
||||
m_Shader: {fileID: 4800000, guid: 0c1cf10ea69e60e4f9eb8955749f88ec, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
data:
|
||||
first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
data:
|
||||
first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
data:
|
||||
first:
|
||||
name: g_flOutlineWidth
|
||||
second: 0.005
|
||||
data:
|
||||
first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
data:
|
||||
first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
data:
|
||||
first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Outline
|
||||
second: 0.005
|
||||
data:
|
||||
first:
|
||||
name: _Opacity
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _node_6969
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _OutlineWidth
|
||||
second: 0.00238
|
||||
m_Colors:
|
||||
data:
|
||||
first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: _Color
|
||||
second: {r: 0.486632, g: 0.78411454, b: 0.8823653, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: g_vOutlineColor
|
||||
second: {r: 0.9485294, g: 0.9223629, b: 0, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: _OutlineColor
|
||||
second: {r: 1, g: 0.9833671, b: 0.39705884, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: _node_2507
|
||||
second: {r: 0.6421389, g: 0.7807802, b: 0.78676474, a: 0}
|
||||
data:
|
||||
first:
|
||||
name: _OutlightColor
|
||||
second: {r: 0.9446255, g: 1, b: 0.42647058, a: 0.347}
|
||||
data:
|
||||
first:
|
||||
name: _node_8174
|
||||
second: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: _node_8282
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b939e5e799d98a469f594828ebab52e
|
||||
timeCreated: 1439237525
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
213
Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat
Normal file
213
Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat
Normal file
@ -0,0 +1,213 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: SeeThru
|
||||
m_Shader: {fileID: 4800000, guid: 6337aa7e7823eee43af8ffe676935e74, type: 3}
|
||||
m_ShaderKeywords: S_SPECULAR_NONE S_UNLIT _ALPHABLEND_ON
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
OriginalShader: Unlit/Texture
|
||||
RenderType: Transparent
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _SpecGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: g_tOverrideLightmap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: PixelSnap
|
||||
second: 0
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _ColorMask
|
||||
second: 15
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 10
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _InvFade
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 2
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _OcclusionStrengthDirectDiffuse
|
||||
second: 1
|
||||
- first:
|
||||
name: _OcclusionStrengthDirectSpecular
|
||||
second: 1
|
||||
- first:
|
||||
name: _OcclusionStrengthIndirectDiffuse
|
||||
second: 1
|
||||
- first:
|
||||
name: _OcclusionStrengthIndirectSpecular
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SpecularMode
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 5
|
||||
- first:
|
||||
name: _Stencil
|
||||
second: 0
|
||||
- first:
|
||||
name: _StencilComp
|
||||
second: 8
|
||||
- first:
|
||||
name: _StencilOp
|
||||
second: 0
|
||||
- first:
|
||||
name: _StencilReadMask
|
||||
second: 255
|
||||
- first:
|
||||
name: _StencilWriteMask
|
||||
second: 255
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 0
|
||||
- first:
|
||||
name: g_bReceiveShadows
|
||||
second: 1
|
||||
- first:
|
||||
name: g_bUnlit
|
||||
second: 1
|
||||
- first:
|
||||
name: g_bWorldAlignedTexture
|
||||
second: 0
|
||||
- first:
|
||||
name: g_flCubeMapScalar
|
||||
second: 1
|
||||
- first:
|
||||
name: g_flReflectanceBias
|
||||
second: 0
|
||||
- first:
|
||||
name: g_flReflectanceMax
|
||||
second: 1
|
||||
- first:
|
||||
name: g_flReflectanceMin
|
||||
second: 0
|
||||
- first:
|
||||
name: g_flReflectanceScale
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0.24999985, g: 0.24999985, b: 0.24999985, a: 0.1254902}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _SpecColor
|
||||
second: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
- first:
|
||||
name: _TintColor
|
||||
second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
||||
- first:
|
||||
name: g_vWorldAlignedNormalTangentU
|
||||
second: {r: -1, g: 0, b: 0, a: 0}
|
||||
- first:
|
||||
name: g_vWorldAlignedNormalTangentV
|
||||
second: {r: 0, g: 0, b: 1, a: 0}
|
||||
- first:
|
||||
name: g_vWorldAlignedTextureNormal
|
||||
second: {r: 0, g: 1, b: 0, a: 0}
|
||||
- first:
|
||||
name: g_vWorldAlignedTexturePosition
|
||||
second: {r: 0, g: 0, b: 0, a: 0}
|
||||
- first:
|
||||
name: g_vWorldAlignedTextureSize
|
||||
second: {r: 1, g: 1, b: 1, a: 0}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bbb445147c574240a8b87a1193788b5
|
||||
timeCreated: 1456708947
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,161 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SteamVRControllerModel
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _EMISSION
|
||||
m_InvalidKeywords:
|
||||
- S_RECEIVE_SHADOWS
|
||||
- S_SPECULAR_METALLIC
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
OriginalShader: Standard
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _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}
|
||||
- g_tOverrideLightmap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.405
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _OcclusionStrengthDirectDiffuse: 1
|
||||
- _OcclusionStrengthDirectSpecular: 1
|
||||
- _OcclusionStrengthIndirectDiffuse: 1
|
||||
- _OcclusionStrengthIndirectSpecular: 1
|
||||
- _Parallax: 0.02
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Smoothness: 0.405
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SpecularMode: 2
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _UVSec: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
- g_bReceiveShadows: 1
|
||||
- g_bUnlit: 0
|
||||
- g_bWorldAlignedTexture: 0
|
||||
- g_flCubeMapScalar: 1
|
||||
- g_flReflectanceBias: 0
|
||||
- g_flReflectanceMax: 1
|
||||
- g_flReflectanceMin: 0
|
||||
- g_flReflectanceScale: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- g_vWorldAlignedNormalTangentU: {r: -1, g: 0, b: 0, a: 0}
|
||||
- g_vWorldAlignedNormalTangentV: {r: 0, g: 0, b: 1, a: 0}
|
||||
- g_vWorldAlignedTextureNormal: {r: 0, g: 1, b: 0, a: 0}
|
||||
- g_vWorldAlignedTexturePosition: {r: 0, g: 0, b: 0, a: 0}
|
||||
- g_vWorldAlignedTextureSize: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &9151495535364576820
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 7
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c433e134e4719444b65bf064a77e22e
|
||||
timeCreated: 1455877211
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/SteamVR/InteractionSystem/Core/Prefabs.meta
Normal file
9
Assets/SteamVR/InteractionSystem/Core/Prefabs.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d60d25020af6fb4f8d436244db7cc4b
|
||||
folderAsset: yes
|
||||
timeCreated: 1479762244
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/HandColliderLeft.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/HandColliderLeft.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73f816dd3537a4c44988f340a5da70b9
|
||||
timeCreated: 1567796930
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/HandColliderRight.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/HandColliderRight.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f378ddf4e9373548a3708d26c1d75a4
|
||||
timeCreated: 1567796810
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModel Alien.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModel Alien.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8d1e5711b2c77d48ac96e769aaff27a
|
||||
timeCreated: 1531273118
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModel Slim.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModel Slim.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5082f7d9f947374197e0a97786f4e40
|
||||
timeCreated: 1531273118
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModel.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModel.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ade79fed86bbd141926d1cd94c98457
|
||||
timeCreated: 1531273118
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModelFloppy.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/LeftRenderModelFloppy.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 534d2fcf558316441a41841275676807
|
||||
timeCreated: 1531273118
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc06161b6d97feb419f45f03b62e14b9
|
||||
timeCreated: 1430240738
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModel Alien.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModel Alien.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3cb7e5f55e66cb40aea59db72c62365
|
||||
timeCreated: 1531273121
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModel Slim.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModel Slim.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 837f93beb9a614743ae3a2c0ada7c388
|
||||
timeCreated: 1531273121
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModel.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModel.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d07386f0ec952ec409dc7753bcf5746b
|
||||
timeCreated: 1531273121
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModelFloppy.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/Core/Prefabs/RightRenderModelFloppy.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c5fea2300124fe49a30168e29627064
|
||||
timeCreated: 1531273121
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/SteamVR/InteractionSystem/Core/Scripts.meta
Normal file
9
Assets/SteamVR/InteractionSystem/Core/Scripts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77a23888f82e2ab4c8bc825f20235e1e
|
||||
folderAsset: yes
|
||||
timeCreated: 1479762244
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,35 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Collider dangling from the player's head
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( CapsuleCollider ) )]
|
||||
public class BodyCollider : MonoBehaviour
|
||||
{
|
||||
public Transform head;
|
||||
|
||||
private CapsuleCollider capsuleCollider;
|
||||
|
||||
//-------------------------------------------------
|
||||
void Awake()
|
||||
{
|
||||
capsuleCollider = GetComponent<CapsuleCollider>();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void FixedUpdate()
|
||||
{
|
||||
float distanceFromFloor = Vector3.Dot( head.localPosition, Vector3.up );
|
||||
capsuleCollider.height = Mathf.Max( capsuleCollider.radius, distanceFromFloor );
|
||||
transform.localPosition = head.localPosition - 0.5f * distanceFromFloor * Vector3.up;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1731d642c0b250b48bb8cdfb153d9792
|
||||
timeCreated: 1544851959
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
548
Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs
Normal file
548
Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs
Normal file
@ -0,0 +1,548 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Interactable that can be used to move in a circular motion
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( Interactable ) )]
|
||||
public class CircularDrive : MonoBehaviour
|
||||
{
|
||||
public enum Axis_t
|
||||
{
|
||||
XAxis,
|
||||
YAxis,
|
||||
ZAxis
|
||||
};
|
||||
|
||||
[Tooltip( "The axis around which the circular drive will rotate in local space" )]
|
||||
public Axis_t axisOfRotation = Axis_t.XAxis;
|
||||
|
||||
[Tooltip( "Child GameObject which has the Collider component to initiate interaction, only needs to be set if there is more than one Collider child" )]
|
||||
public Collider childCollider = null;
|
||||
|
||||
[Tooltip( "A LinearMapping component to drive, if not specified one will be dynamically added to this GameObject" )]
|
||||
public LinearMapping linearMapping;
|
||||
|
||||
[Tooltip( "If true, the drive will stay manipulating as long as the button is held down, if false, it will stop if the controller moves out of the collider" )]
|
||||
public bool hoverLock = false;
|
||||
|
||||
[HeaderAttribute( "Limited Rotation" )]
|
||||
[Tooltip( "If true, the rotation will be limited to [minAngle, maxAngle], if false, the rotation is unlimited" )]
|
||||
public bool limited = false;
|
||||
public Vector2 frozenDistanceMinMaxThreshold = new Vector2( 0.1f, 0.2f );
|
||||
public UnityEvent onFrozenDistanceThreshold;
|
||||
|
||||
[HeaderAttribute( "Limited Rotation Min" )]
|
||||
[Tooltip( "If limited is true, the specifies the lower limit, otherwise value is unused" )]
|
||||
public float minAngle = -45.0f;
|
||||
[Tooltip( "If limited, set whether drive will freeze its angle when the min angle is reached" )]
|
||||
public bool freezeOnMin = false;
|
||||
[Tooltip( "If limited, event invoked when minAngle is reached" )]
|
||||
public UnityEvent onMinAngle;
|
||||
|
||||
[HeaderAttribute( "Limited Rotation Max" )]
|
||||
[Tooltip( "If limited is true, the specifies the upper limit, otherwise value is unused" )]
|
||||
public float maxAngle = 45.0f;
|
||||
[Tooltip( "If limited, set whether drive will freeze its angle when the max angle is reached" )]
|
||||
public bool freezeOnMax = false;
|
||||
[Tooltip( "If limited, event invoked when maxAngle is reached" )]
|
||||
public UnityEvent onMaxAngle;
|
||||
|
||||
[Tooltip( "If limited is true, this forces the starting angle to be startAngle, clamped to [minAngle, maxAngle]" )]
|
||||
public bool forceStart = false;
|
||||
[Tooltip( "If limited is true and forceStart is true, the starting angle will be this, clamped to [minAngle, maxAngle]" )]
|
||||
public float startAngle = 0.0f;
|
||||
|
||||
[Tooltip( "If true, the transform of the GameObject this component is on will be rotated accordingly" )]
|
||||
public bool rotateGameObject = true;
|
||||
|
||||
[Tooltip( "If true, the path of the Hand (red) and the projected value (green) will be drawn" )]
|
||||
public bool debugPath = false;
|
||||
[Tooltip( "If debugPath is true, this is the maximum number of GameObjects to create to draw the path" )]
|
||||
public int dbgPathLimit = 50;
|
||||
|
||||
[Tooltip( "If not null, the TextMesh will display the linear value and the angular value of this circular drive" )]
|
||||
public TextMesh debugText = null;
|
||||
|
||||
[Tooltip( "The output angle value of the drive in degrees, unlimited will increase or decrease without bound, take the 360 modulus to find number of rotations" )]
|
||||
public float outAngle;
|
||||
|
||||
private Quaternion start;
|
||||
|
||||
private Vector3 worldPlaneNormal = new Vector3( 1.0f, 0.0f, 0.0f );
|
||||
private Vector3 localPlaneNormal = new Vector3( 1.0f, 0.0f, 0.0f );
|
||||
|
||||
private Vector3 lastHandProjected;
|
||||
|
||||
private Color red = new Color( 1.0f, 0.0f, 0.0f );
|
||||
private Color green = new Color( 0.0f, 1.0f, 0.0f );
|
||||
|
||||
private GameObject[] dbgHandObjects;
|
||||
private GameObject[] dbgProjObjects;
|
||||
private GameObject dbgObjectsParent;
|
||||
private int dbgObjectCount = 0;
|
||||
private int dbgObjectIndex = 0;
|
||||
|
||||
private bool driving = false;
|
||||
|
||||
// If the drive is limited as is at min/max, angles greater than this are ignored
|
||||
private float minMaxAngularThreshold = 1.0f;
|
||||
|
||||
private bool frozen = false;
|
||||
private float frozenAngle = 0.0f;
|
||||
private Vector3 frozenHandWorldPos = new Vector3( 0.0f, 0.0f, 0.0f );
|
||||
private Vector2 frozenSqDistanceMinMaxThreshold = new Vector2( 0.0f, 0.0f );
|
||||
|
||||
private Hand handHoverLocked = null;
|
||||
|
||||
private Interactable interactable;
|
||||
|
||||
//-------------------------------------------------
|
||||
private void Freeze( Hand hand )
|
||||
{
|
||||
frozen = true;
|
||||
frozenAngle = outAngle;
|
||||
frozenHandWorldPos = hand.hoverSphereTransform.position;
|
||||
frozenSqDistanceMinMaxThreshold.x = frozenDistanceMinMaxThreshold.x * frozenDistanceMinMaxThreshold.x;
|
||||
frozenSqDistanceMinMaxThreshold.y = frozenDistanceMinMaxThreshold.y * frozenDistanceMinMaxThreshold.y;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void UnFreeze()
|
||||
{
|
||||
frozen = false;
|
||||
frozenHandWorldPos.Set( 0.0f, 0.0f, 0.0f );
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
interactable = this.GetComponent<Interactable>();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
private void Start()
|
||||
{
|
||||
if ( childCollider == null )
|
||||
{
|
||||
childCollider = GetComponentInChildren<Collider>();
|
||||
}
|
||||
|
||||
if ( linearMapping == null )
|
||||
{
|
||||
linearMapping = GetComponent<LinearMapping>();
|
||||
}
|
||||
|
||||
if ( linearMapping == null )
|
||||
{
|
||||
linearMapping = gameObject.AddComponent<LinearMapping>();
|
||||
}
|
||||
|
||||
worldPlaneNormal = new Vector3( 0.0f, 0.0f, 0.0f );
|
||||
worldPlaneNormal[(int)axisOfRotation] = 1.0f;
|
||||
|
||||
localPlaneNormal = worldPlaneNormal;
|
||||
|
||||
if ( transform.parent )
|
||||
{
|
||||
worldPlaneNormal = transform.parent.localToWorldMatrix.MultiplyVector( worldPlaneNormal ).normalized;
|
||||
}
|
||||
|
||||
if ( limited )
|
||||
{
|
||||
start = Quaternion.identity;
|
||||
outAngle = transform.localEulerAngles[(int)axisOfRotation];
|
||||
|
||||
if ( forceStart )
|
||||
{
|
||||
outAngle = Mathf.Clamp( startAngle, minAngle, maxAngle );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
start = Quaternion.AngleAxis( transform.localEulerAngles[(int)axisOfRotation], localPlaneNormal );
|
||||
outAngle = 0.0f;
|
||||
}
|
||||
|
||||
if ( debugText )
|
||||
{
|
||||
debugText.alignment = TextAlignment.Left;
|
||||
debugText.anchor = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
UpdateAll();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void OnDisable()
|
||||
{
|
||||
if ( handHoverLocked )
|
||||
{
|
||||
handHoverLocked.HideGrabHint();
|
||||
handHoverLocked.HoverUnlock(interactable);
|
||||
handHoverLocked = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private IEnumerator HapticPulses( Hand hand, float flMagnitude, int nCount )
|
||||
{
|
||||
if ( hand != null )
|
||||
{
|
||||
int nRangeMax = (int)Util.RemapNumberClamped( flMagnitude, 0.0f, 1.0f, 100.0f, 900.0f );
|
||||
nCount = Mathf.Clamp( nCount, 1, 10 );
|
||||
|
||||
//float hapticDuration = nRangeMax * nCount;
|
||||
|
||||
//hand.TriggerHapticPulse(hapticDuration, nRangeMax, flMagnitude);
|
||||
|
||||
for ( ushort i = 0; i < nCount; ++i )
|
||||
{
|
||||
ushort duration = (ushort)Random.Range( 100, nRangeMax );
|
||||
hand.TriggerHapticPulse( duration );
|
||||
yield return new WaitForSeconds( .01f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverBegin( Hand hand )
|
||||
{
|
||||
hand.ShowGrabHint();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverEnd( Hand hand )
|
||||
{
|
||||
hand.HideGrabHint();
|
||||
|
||||
if ( driving && hand )
|
||||
{
|
||||
//hand.TriggerHapticPulse() //todo: fix
|
||||
StartCoroutine( HapticPulses( hand, 1.0f, 10 ) );
|
||||
}
|
||||
|
||||
driving = false;
|
||||
handHoverLocked = null;
|
||||
}
|
||||
|
||||
private GrabTypes grabbedWithType;
|
||||
//-------------------------------------------------
|
||||
private void HandHoverUpdate( Hand hand )
|
||||
{
|
||||
GrabTypes startingGrabType = hand.GetGrabStarting();
|
||||
bool isGrabEnding = hand.IsGrabbingWithType(grabbedWithType) == false;
|
||||
|
||||
if (grabbedWithType == GrabTypes.None && startingGrabType != GrabTypes.None)
|
||||
{
|
||||
grabbedWithType = startingGrabType;
|
||||
// Trigger was just pressed
|
||||
lastHandProjected = ComputeToTransformProjected( hand.hoverSphereTransform );
|
||||
|
||||
if ( hoverLock )
|
||||
{
|
||||
hand.HoverLock(interactable);
|
||||
handHoverLocked = hand;
|
||||
}
|
||||
|
||||
driving = true;
|
||||
|
||||
ComputeAngle( hand );
|
||||
UpdateAll();
|
||||
|
||||
hand.HideGrabHint();
|
||||
}
|
||||
else if (grabbedWithType != GrabTypes.None && isGrabEnding)
|
||||
{
|
||||
// Trigger was just released
|
||||
if ( hoverLock )
|
||||
{
|
||||
hand.HoverUnlock(interactable);
|
||||
handHoverLocked = null;
|
||||
}
|
||||
|
||||
driving = false;
|
||||
grabbedWithType = GrabTypes.None;
|
||||
}
|
||||
|
||||
if ( driving && isGrabEnding == false && hand.hoveringInteractable == this.interactable )
|
||||
{
|
||||
ComputeAngle( hand );
|
||||
UpdateAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private Vector3 ComputeToTransformProjected( Transform xForm )
|
||||
{
|
||||
Vector3 toTransform = ( xForm.position - transform.position ).normalized;
|
||||
Vector3 toTransformProjected = new Vector3( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Need a non-zero distance from the hand to the center of the CircularDrive
|
||||
if ( toTransform.sqrMagnitude > 0.0f )
|
||||
{
|
||||
toTransformProjected = Vector3.ProjectOnPlane( toTransform, worldPlaneNormal ).normalized;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogFormat("<b>[SteamVR Interaction]</b> The collider needs to be a minimum distance away from the CircularDrive GameObject {0}", gameObject.ToString() );
|
||||
Debug.Assert( false, string.Format("<b>[SteamVR Interaction]</b> The collider needs to be a minimum distance away from the CircularDrive GameObject {0}", gameObject.ToString() ) );
|
||||
}
|
||||
|
||||
if ( debugPath && dbgPathLimit > 0 )
|
||||
{
|
||||
DrawDebugPath( xForm, toTransformProjected );
|
||||
}
|
||||
|
||||
return toTransformProjected;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void DrawDebugPath( Transform xForm, Vector3 toTransformProjected )
|
||||
{
|
||||
if ( dbgObjectCount == 0 )
|
||||
{
|
||||
dbgObjectsParent = new GameObject( "Circular Drive Debug" );
|
||||
dbgHandObjects = new GameObject[dbgPathLimit];
|
||||
dbgProjObjects = new GameObject[dbgPathLimit];
|
||||
dbgObjectCount = dbgPathLimit;
|
||||
dbgObjectIndex = 0;
|
||||
}
|
||||
|
||||
//Actual path
|
||||
GameObject gSphere = null;
|
||||
|
||||
if ( dbgHandObjects[dbgObjectIndex] )
|
||||
{
|
||||
gSphere = dbgHandObjects[dbgObjectIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
gSphere = GameObject.CreatePrimitive( PrimitiveType.Sphere );
|
||||
gSphere.transform.SetParent( dbgObjectsParent.transform );
|
||||
dbgHandObjects[dbgObjectIndex] = gSphere;
|
||||
}
|
||||
|
||||
gSphere.name = string.Format( "actual_{0}", (int)( ( 1.0f - red.r ) * 10.0f ) );
|
||||
gSphere.transform.position = xForm.position;
|
||||
gSphere.transform.rotation = Quaternion.Euler( 0.0f, 0.0f, 0.0f );
|
||||
gSphere.transform.localScale = new Vector3( 0.004f, 0.004f, 0.004f );
|
||||
gSphere.gameObject.GetComponent<Renderer>().material.color = red;
|
||||
|
||||
if ( red.r > 0.1f )
|
||||
{
|
||||
red.r -= 0.1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
red.r = 1.0f;
|
||||
}
|
||||
|
||||
//Projected path
|
||||
gSphere = null;
|
||||
|
||||
if ( dbgProjObjects[dbgObjectIndex] )
|
||||
{
|
||||
gSphere = dbgProjObjects[dbgObjectIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
gSphere = GameObject.CreatePrimitive( PrimitiveType.Sphere );
|
||||
gSphere.transform.SetParent( dbgObjectsParent.transform );
|
||||
dbgProjObjects[dbgObjectIndex] = gSphere;
|
||||
}
|
||||
|
||||
gSphere.name = string.Format( "projed_{0}", (int)( ( 1.0f - green.g ) * 10.0f ) );
|
||||
gSphere.transform.position = transform.position + toTransformProjected * 0.25f;
|
||||
gSphere.transform.rotation = Quaternion.Euler( 0.0f, 0.0f, 0.0f );
|
||||
gSphere.transform.localScale = new Vector3( 0.004f, 0.004f, 0.004f );
|
||||
gSphere.gameObject.GetComponent<Renderer>().material.color = green;
|
||||
|
||||
if ( green.g > 0.1f )
|
||||
{
|
||||
green.g -= 0.1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
green.g = 1.0f;
|
||||
}
|
||||
|
||||
dbgObjectIndex = ( dbgObjectIndex + 1 ) % dbgObjectCount;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Updates the LinearMapping value from the angle
|
||||
//-------------------------------------------------
|
||||
private void UpdateLinearMapping()
|
||||
{
|
||||
if ( limited )
|
||||
{
|
||||
// Map it to a [0, 1] value
|
||||
linearMapping.value = ( outAngle - minAngle ) / ( maxAngle - minAngle );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normalize to [0, 1] based on 360 degree windings
|
||||
float flTmp = outAngle / 360.0f;
|
||||
linearMapping.value = flTmp - Mathf.Floor( flTmp );
|
||||
}
|
||||
|
||||
UpdateDebugText();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Updates the LinearMapping value from the angle
|
||||
//-------------------------------------------------
|
||||
private void UpdateGameObject()
|
||||
{
|
||||
if ( rotateGameObject )
|
||||
{
|
||||
transform.localRotation = start * Quaternion.AngleAxis( outAngle, localPlaneNormal );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Updates the Debug TextMesh with the linear mapping value and the angle
|
||||
//-------------------------------------------------
|
||||
private void UpdateDebugText()
|
||||
{
|
||||
if ( debugText )
|
||||
{
|
||||
debugText.text = string.Format( "Linear: {0}\nAngle: {1}\n", linearMapping.value, outAngle );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Updates the Debug TextMesh with the linear mapping value and the angle
|
||||
//-------------------------------------------------
|
||||
private void UpdateAll()
|
||||
{
|
||||
UpdateLinearMapping();
|
||||
UpdateGameObject();
|
||||
UpdateDebugText();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Computes the angle to rotate the game object based on the change in the transform
|
||||
//-------------------------------------------------
|
||||
private void ComputeAngle( Hand hand )
|
||||
{
|
||||
Vector3 toHandProjected = ComputeToTransformProjected( hand.hoverSphereTransform );
|
||||
|
||||
if ( !toHandProjected.Equals( lastHandProjected ) )
|
||||
{
|
||||
float absAngleDelta = Vector3.Angle( lastHandProjected, toHandProjected );
|
||||
|
||||
if ( absAngleDelta > 0.0f )
|
||||
{
|
||||
if ( frozen )
|
||||
{
|
||||
float frozenSqDist = ( hand.hoverSphereTransform.position - frozenHandWorldPos ).sqrMagnitude;
|
||||
if ( frozenSqDist > frozenSqDistanceMinMaxThreshold.x )
|
||||
{
|
||||
outAngle = frozenAngle + Random.Range( -1.0f, 1.0f );
|
||||
|
||||
float magnitude = Util.RemapNumberClamped( frozenSqDist, frozenSqDistanceMinMaxThreshold.x, frozenSqDistanceMinMaxThreshold.y, 0.0f, 1.0f );
|
||||
if ( magnitude > 0 )
|
||||
{
|
||||
StartCoroutine( HapticPulses( hand, magnitude, 10 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCoroutine( HapticPulses( hand, 0.5f, 10 ) );
|
||||
}
|
||||
|
||||
if ( frozenSqDist >= frozenSqDistanceMinMaxThreshold.y )
|
||||
{
|
||||
onFrozenDistanceThreshold.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 cross = Vector3.Cross( lastHandProjected, toHandProjected ).normalized;
|
||||
float dot = Vector3.Dot( worldPlaneNormal, cross );
|
||||
|
||||
float signedAngleDelta = absAngleDelta;
|
||||
|
||||
if ( dot < 0.0f )
|
||||
{
|
||||
signedAngleDelta = -signedAngleDelta;
|
||||
}
|
||||
|
||||
if ( limited )
|
||||
{
|
||||
float angleTmp = Mathf.Clamp( outAngle + signedAngleDelta, minAngle, maxAngle );
|
||||
|
||||
if ( outAngle == minAngle )
|
||||
{
|
||||
if ( angleTmp > minAngle && absAngleDelta < minMaxAngularThreshold )
|
||||
{
|
||||
outAngle = angleTmp;
|
||||
lastHandProjected = toHandProjected;
|
||||
}
|
||||
}
|
||||
else if ( outAngle == maxAngle )
|
||||
{
|
||||
if ( angleTmp < maxAngle && absAngleDelta < minMaxAngularThreshold )
|
||||
{
|
||||
outAngle = angleTmp;
|
||||
lastHandProjected = toHandProjected;
|
||||
}
|
||||
}
|
||||
else if ( angleTmp == minAngle )
|
||||
{
|
||||
outAngle = angleTmp;
|
||||
lastHandProjected = toHandProjected;
|
||||
onMinAngle.Invoke();
|
||||
if ( freezeOnMin )
|
||||
{
|
||||
Freeze( hand );
|
||||
}
|
||||
}
|
||||
else if ( angleTmp == maxAngle )
|
||||
{
|
||||
outAngle = angleTmp;
|
||||
lastHandProjected = toHandProjected;
|
||||
onMaxAngle.Invoke();
|
||||
if ( freezeOnMax )
|
||||
{
|
||||
Freeze( hand );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outAngle = angleTmp;
|
||||
lastHandProjected = toHandProjected;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outAngle += signedAngleDelta;
|
||||
lastHandProjected = toHandProjected;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f32883eed859804dbb0c5fedac91496
|
||||
timeCreated: 1544851960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,192 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Throwable that uses physics joints to attach instead of just
|
||||
// parenting
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( Interactable ) )]
|
||||
public class ComplexThrowable : MonoBehaviour
|
||||
{
|
||||
public enum AttachMode
|
||||
{
|
||||
FixedJoint,
|
||||
Force,
|
||||
}
|
||||
|
||||
public float attachForce = 800.0f;
|
||||
public float attachForceDamper = 25.0f;
|
||||
|
||||
public AttachMode attachMode = AttachMode.FixedJoint;
|
||||
|
||||
[EnumFlags]
|
||||
public Hand.AttachmentFlags attachmentFlags = 0;
|
||||
|
||||
private List<Hand> holdingHands = new List<Hand>();
|
||||
private List<Rigidbody> holdingBodies = new List<Rigidbody>();
|
||||
private List<Vector3> holdingPoints = new List<Vector3>();
|
||||
|
||||
private List<Rigidbody> rigidBodies = new List<Rigidbody>();
|
||||
|
||||
//-------------------------------------------------
|
||||
void Awake()
|
||||
{
|
||||
GetComponentsInChildren<Rigidbody>( rigidBodies );
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void Update()
|
||||
{
|
||||
for ( int i = 0; i < holdingHands.Count; i++ )
|
||||
{
|
||||
if (holdingHands[i].IsGrabEnding(this.gameObject))
|
||||
{
|
||||
PhysicsDetach( holdingHands[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverBegin( Hand hand )
|
||||
{
|
||||
if ( holdingHands.IndexOf( hand ) == -1 )
|
||||
{
|
||||
if ( hand.isActive )
|
||||
{
|
||||
hand.TriggerHapticPulse( 800 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverEnd( Hand hand )
|
||||
{
|
||||
if ( holdingHands.IndexOf( hand ) == -1 )
|
||||
{
|
||||
if (hand.isActive)
|
||||
{
|
||||
hand.TriggerHapticPulse( 500 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void HandHoverUpdate( Hand hand )
|
||||
{
|
||||
GrabTypes startingGrabType = hand.GetGrabStarting();
|
||||
|
||||
if (startingGrabType != GrabTypes.None)
|
||||
{
|
||||
PhysicsAttach( hand, startingGrabType );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void PhysicsAttach( Hand hand, GrabTypes startingGrabType )
|
||||
{
|
||||
PhysicsDetach( hand );
|
||||
|
||||
Rigidbody holdingBody = null;
|
||||
Vector3 holdingPoint = Vector3.zero;
|
||||
|
||||
// The hand should grab onto the nearest rigid body
|
||||
float closestDistance = float.MaxValue;
|
||||
for ( int i = 0; i < rigidBodies.Count; i++ )
|
||||
{
|
||||
float distance = Vector3.Distance( rigidBodies[i].worldCenterOfMass, hand.transform.position );
|
||||
if ( distance < closestDistance )
|
||||
{
|
||||
holdingBody = rigidBodies[i];
|
||||
closestDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
// Couldn't grab onto a body
|
||||
if ( holdingBody == null )
|
||||
return;
|
||||
|
||||
// Create a fixed joint from the hand to the holding body
|
||||
if ( attachMode == AttachMode.FixedJoint )
|
||||
{
|
||||
Rigidbody handRigidbody = Util.FindOrAddComponent<Rigidbody>( hand.gameObject );
|
||||
handRigidbody.isKinematic = true;
|
||||
|
||||
FixedJoint handJoint = hand.gameObject.AddComponent<FixedJoint>();
|
||||
handJoint.connectedBody = holdingBody;
|
||||
}
|
||||
|
||||
// Don't let the hand interact with other things while it's holding us
|
||||
hand.HoverLock( null );
|
||||
|
||||
// Affix this point
|
||||
Vector3 offset = hand.transform.position - holdingBody.worldCenterOfMass;
|
||||
offset = Mathf.Min( offset.magnitude, 1.0f ) * offset.normalized;
|
||||
holdingPoint = holdingBody.transform.InverseTransformPoint( holdingBody.worldCenterOfMass + offset );
|
||||
|
||||
hand.AttachObject( this.gameObject, startingGrabType, attachmentFlags );
|
||||
|
||||
// Update holding list
|
||||
holdingHands.Add( hand );
|
||||
holdingBodies.Add( holdingBody );
|
||||
holdingPoints.Add( holdingPoint );
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private bool PhysicsDetach( Hand hand )
|
||||
{
|
||||
int i = holdingHands.IndexOf( hand );
|
||||
|
||||
if ( i != -1 )
|
||||
{
|
||||
// Detach this object from the hand
|
||||
holdingHands[i].DetachObject( this.gameObject, false );
|
||||
|
||||
// Allow the hand to do other things
|
||||
holdingHands[i].HoverUnlock( null );
|
||||
|
||||
// Delete any existing joints from the hand
|
||||
if ( attachMode == AttachMode.FixedJoint )
|
||||
{
|
||||
Destroy( holdingHands[i].GetComponent<FixedJoint>() );
|
||||
}
|
||||
|
||||
Util.FastRemove( holdingHands, i );
|
||||
Util.FastRemove( holdingBodies, i );
|
||||
Util.FastRemove( holdingPoints, i );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void FixedUpdate()
|
||||
{
|
||||
if ( attachMode == AttachMode.Force )
|
||||
{
|
||||
for ( int i = 0; i < holdingHands.Count; i++ )
|
||||
{
|
||||
Vector3 targetPoint = holdingBodies[i].transform.TransformPoint( holdingPoints[i] );
|
||||
Vector3 vdisplacement = holdingHands[i].transform.position - targetPoint;
|
||||
|
||||
holdingBodies[i].AddForceAtPosition( attachForce * vdisplacement, targetPoint, ForceMode.Acceleration );
|
||||
holdingBodies[i].AddForceAtPosition( -attachForceDamper * holdingBodies[i].GetPointVelocity( targetPoint ), targetPoint, ForceMode.Acceleration );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad77666522338cf49ba83b80b25e6476
|
||||
timeCreated: 1544851960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,132 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Highlights the controller when hovering over interactables
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class ControllerHoverHighlight : MonoBehaviour
|
||||
{
|
||||
public Material highLightMaterial;
|
||||
public bool fireHapticsOnHightlight = true;
|
||||
|
||||
protected Hand hand;
|
||||
|
||||
protected RenderModel renderModel;
|
||||
|
||||
protected SteamVR_Events.Action renderModelLoadedAction;
|
||||
|
||||
protected void Awake()
|
||||
{
|
||||
hand = GetComponentInParent<Hand>();
|
||||
}
|
||||
|
||||
protected void OnHandInitialized(int deviceIndex)
|
||||
{
|
||||
GameObject renderModelGameObject = GameObject.Instantiate(hand.renderModelPrefab);
|
||||
renderModelGameObject.transform.parent = this.transform;
|
||||
renderModelGameObject.transform.localPosition = Vector3.zero;
|
||||
renderModelGameObject.transform.localRotation = Quaternion.identity;
|
||||
renderModelGameObject.transform.localScale = hand.renderModelPrefab.transform.localScale;
|
||||
|
||||
|
||||
renderModel = renderModelGameObject.GetComponent<RenderModel>();
|
||||
|
||||
renderModel.SetInputSource(hand.handType);
|
||||
renderModel.OnHandInitialized(deviceIndex);
|
||||
renderModel.SetMaterial(highLightMaterial);
|
||||
|
||||
hand.SetHoverRenderModel(renderModel);
|
||||
renderModel.onControllerLoaded += RenderModel_onControllerLoaded;
|
||||
renderModel.Hide();
|
||||
}
|
||||
|
||||
private void RenderModel_onControllerLoaded()
|
||||
{
|
||||
renderModel.Hide();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
protected void OnParentHandHoverBegin(Interactable other)
|
||||
{
|
||||
if (!this.isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.transform.parent != transform.parent)
|
||||
{
|
||||
ShowHighlight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnParentHandHoverEnd(Interactable other)
|
||||
{
|
||||
HideHighlight();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnParentHandInputFocusAcquired()
|
||||
{
|
||||
if (!this.isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (hand.hoveringInteractable && hand.hoveringInteractable.transform.parent != transform.parent)
|
||||
{
|
||||
ShowHighlight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnParentHandInputFocusLost()
|
||||
{
|
||||
HideHighlight();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
public void ShowHighlight()
|
||||
{
|
||||
if (renderModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fireHapticsOnHightlight)
|
||||
{
|
||||
hand.TriggerHapticPulse(500);
|
||||
}
|
||||
|
||||
renderModel.Show();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
public void HideHighlight()
|
||||
{
|
||||
if (renderModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fireHapticsOnHightlight)
|
||||
{
|
||||
hand.TriggerHapticPulse(300);
|
||||
}
|
||||
|
||||
renderModel.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ca2cc563cc33f542a5d9f8f661184ba
|
||||
timeCreated: 1544851960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,28 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Custom Unity Events that take in additional parameters
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine.Events;
|
||||
using System;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public static class CustomEvents
|
||||
{
|
||||
//-------------------------------------------------
|
||||
[System.Serializable]
|
||||
public class UnityEventSingleFloat : UnityEvent<float>
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
[System.Serializable]
|
||||
public class UnityEventHand : UnityEvent<Hand>
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f3294e06115d0047a2ac7659a11b168
|
||||
timeCreated: 1544851960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
50
Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs
Normal file
50
Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs
Normal file
@ -0,0 +1,50 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Debug UI shown for the player
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class DebugUI : MonoBehaviour
|
||||
{
|
||||
private Player player;
|
||||
|
||||
//-------------------------------------------------
|
||||
static private DebugUI _instance;
|
||||
static public DebugUI instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _instance == null )
|
||||
{
|
||||
_instance = GameObject.FindObjectOfType<DebugUI>();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void Start()
|
||||
{
|
||||
player = Player.instance;
|
||||
}
|
||||
|
||||
|
||||
#if !HIDE_DEBUG_UI
|
||||
//-------------------------------------------------
|
||||
private void OnGUI()
|
||||
{
|
||||
if (Debug.isDebugBuild)
|
||||
{
|
||||
player.Draw2DDebug();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f3bba2c36dd79242b3157dbcd876bf2
|
||||
timeCreated: 1544851961
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,22 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Destroys this object when it is detached from the hand
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( Interactable ) )]
|
||||
public class DestroyOnDetachedFromHand : MonoBehaviour
|
||||
{
|
||||
//-------------------------------------------------
|
||||
private void OnDetachedFromHand( Hand hand )
|
||||
{
|
||||
Destroy( gameObject );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5240357a2468cdc4291b266bee3cb9b9
|
||||
timeCreated: 1544851961
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,36 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Destroys this object when its particle system dies
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( ParticleSystem ) )]
|
||||
public class DestroyOnParticleSystemDeath : MonoBehaviour
|
||||
{
|
||||
private ParticleSystem particles;
|
||||
|
||||
//-------------------------------------------------
|
||||
void Awake()
|
||||
{
|
||||
particles = GetComponent<ParticleSystem>();
|
||||
|
||||
InvokeRepeating( "CheckParticleSystem", 0.1f, 0.1f );
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void CheckParticleSystem()
|
||||
{
|
||||
if ( !particles.IsAlive() )
|
||||
{
|
||||
Destroy( this.gameObject );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69cad530c565c714491a326c21accb90
|
||||
timeCreated: 1544851961
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,38 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Destroys this object when it enters a trigger
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class DestroyOnTriggerEnter : MonoBehaviour
|
||||
{
|
||||
public string tagFilter;
|
||||
|
||||
private bool useTag;
|
||||
|
||||
//-------------------------------------------------
|
||||
void Start()
|
||||
{
|
||||
if ( !string.IsNullOrEmpty( tagFilter ) )
|
||||
{
|
||||
useTag = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void OnTriggerEnter( Collider collider )
|
||||
{
|
||||
if ( !useTag || ( useTag && collider.gameObject.tag == tagFilter ) )
|
||||
{
|
||||
Destroy( collider.gameObject.transform.root.gameObject );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ba84888c9d4c504cb752a3904551a6c
|
||||
timeCreated: 1544851961
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,44 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Triggers haptic pulses based on distance between 2 positions
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class DistanceHaptics : MonoBehaviour
|
||||
{
|
||||
public Transform firstTransform;
|
||||
public Transform secondTransform;
|
||||
|
||||
public AnimationCurve distanceIntensityCurve = AnimationCurve.Linear( 0.0f, 800.0f, 1.0f, 800.0f );
|
||||
public AnimationCurve pulseIntervalCurve = AnimationCurve.Linear( 0.0f, 0.01f, 1.0f, 0.0f );
|
||||
|
||||
//-------------------------------------------------
|
||||
IEnumerator Start()
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
float distance = Vector3.Distance( firstTransform.position, secondTransform.position );
|
||||
|
||||
Hand hand = GetComponentInParent<Hand>();
|
||||
if (hand != null)
|
||||
{
|
||||
float pulse = distanceIntensityCurve.Evaluate( distance );
|
||||
hand.TriggerHapticPulse((ushort)pulse);
|
||||
|
||||
//SteamVR_Controller.Input( (int)trackedObject.index ).TriggerHapticPulse( (ushort)pulse );
|
||||
}
|
||||
|
||||
float nextPulse = pulseIntervalCurve.Evaluate( distance );
|
||||
|
||||
yield return new WaitForSeconds( nextPulse );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65ef702aaa09d3f46a75659678b1a711
|
||||
timeCreated: 1544851961
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,21 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: This object won't be destroyed when a new scene is loaded
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class DontDestroyOnLoad : MonoBehaviour
|
||||
{
|
||||
//-------------------------------------------------
|
||||
void Awake()
|
||||
{
|
||||
DontDestroyOnLoad( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d1c07a6449b0ca439ee6fac5f6f7d83
|
||||
timeCreated: 1544851961
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs
Normal file
32
Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs
Normal file
@ -0,0 +1,32 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Allows Enums to be shown in the inspector as flags
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class EnumFlags : PropertyAttribute
|
||||
{
|
||||
public EnumFlags() { }
|
||||
}
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
//-------------------------------------------------------------------------
|
||||
[CustomPropertyDrawer( typeof( EnumFlags ) )]
|
||||
public class EnumFlagsPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI( Rect position, SerializedProperty property, GUIContent label )
|
||||
{
|
||||
property.intValue = EditorGUI.MaskField( position, label, property.intValue, property.enumNames );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88a2ccbdad9948c45b28f5e63902705b
|
||||
timeCreated: 1544851961
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
Assets/SteamVR/InteractionSystem/Core/Scripts/Equippable.cs
Normal file
76
Assets/SteamVR/InteractionSystem/Core/Scripts/Equippable.cs
Normal file
@ -0,0 +1,76 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Flip Object to match which hand you pick it up in
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
|
||||
public enum WhichHand
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
|
||||
[RequireComponent(typeof(Throwable))]
|
||||
|
||||
public class Equippable : MonoBehaviour
|
||||
{
|
||||
|
||||
[Tooltip("Array of children you do not want to be mirrored. Text, logos, etc.")]
|
||||
public Transform[] antiFlip;
|
||||
|
||||
public WhichHand defaultHand = WhichHand.Right;
|
||||
|
||||
private Vector3 initialScale;
|
||||
private Interactable interactable;
|
||||
|
||||
[HideInInspector]
|
||||
public SteamVR_Input_Sources attachedHandType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (interactable.attachedToHand)
|
||||
return interactable.attachedToHand.handType;
|
||||
else
|
||||
return SteamVR_Input_Sources.Any;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
initialScale = transform.localScale;
|
||||
interactable = GetComponent<Interactable>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (interactable.attachedToHand)
|
||||
{
|
||||
Vector3 flipScale = initialScale;
|
||||
if ((attachedHandType == SteamVR_Input_Sources.RightHand && defaultHand == WhichHand.Right) || (attachedHandType == SteamVR_Input_Sources.LeftHand && defaultHand == WhichHand.Left))
|
||||
{
|
||||
flipScale.x *= 1;
|
||||
for (int transformIndex = 0; transformIndex < antiFlip.Length; transformIndex++)
|
||||
{
|
||||
antiFlip[transformIndex].localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flipScale.x *= -1;
|
||||
for (int transformIndex = 0; transformIndex < antiFlip.Length; transformIndex++)
|
||||
{
|
||||
antiFlip[transformIndex].localScale = new Vector3(-1, 1, 1);
|
||||
}
|
||||
}
|
||||
transform.localScale = flipScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecd73422fbc4be54a9f4d8f3972f8579
|
||||
timeCreated: 1544851962
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,106 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Controls for the non-VR debug camera
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( Camera ) )]
|
||||
public class FallbackCameraController : MonoBehaviour
|
||||
{
|
||||
public float speed = 4.0f;
|
||||
public float shiftSpeed = 16.0f;
|
||||
public bool showInstructions = true;
|
||||
|
||||
private Vector3 startEulerAngles;
|
||||
private Vector3 startMousePosition;
|
||||
private float realTime;
|
||||
|
||||
//-------------------------------------------------
|
||||
void OnEnable()
|
||||
{
|
||||
realTime = Time.realtimeSinceStartup;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void Update()
|
||||
{
|
||||
float forward = 0.0f;
|
||||
if ( Input.GetKey( KeyCode.W ) || Input.GetKey( KeyCode.UpArrow ) )
|
||||
{
|
||||
forward += 1.0f;
|
||||
}
|
||||
if ( Input.GetKey( KeyCode.S ) || Input.GetKey( KeyCode.DownArrow ) )
|
||||
{
|
||||
forward -= 1.0f;
|
||||
}
|
||||
|
||||
float up = 0.0f;
|
||||
if (Input.GetKey(KeyCode.E))
|
||||
{
|
||||
up += 1.0f;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.Q))
|
||||
{
|
||||
up -= 1.0f;
|
||||
}
|
||||
|
||||
float right = 0.0f;
|
||||
if ( Input.GetKey( KeyCode.D ) || Input.GetKey( KeyCode.RightArrow ) )
|
||||
{
|
||||
right += 1.0f;
|
||||
}
|
||||
if ( Input.GetKey( KeyCode.A ) || Input.GetKey( KeyCode.LeftArrow ) )
|
||||
{
|
||||
right -= 1.0f;
|
||||
}
|
||||
|
||||
float currentSpeed = speed;
|
||||
if ( Input.GetKey( KeyCode.LeftShift ) || Input.GetKey( KeyCode.RightShift ) )
|
||||
{
|
||||
currentSpeed = shiftSpeed;
|
||||
}
|
||||
|
||||
float realTimeNow = Time.realtimeSinceStartup;
|
||||
float deltaRealTime = realTimeNow - realTime;
|
||||
realTime = realTimeNow;
|
||||
|
||||
Vector3 delta = new Vector3( right, up, forward ) * currentSpeed * deltaRealTime;
|
||||
|
||||
transform.position += transform.TransformDirection( delta );
|
||||
|
||||
Vector3 mousePosition = Input.mousePosition;
|
||||
|
||||
if ( Input.GetMouseButtonDown( 1 ) /* right mouse */)
|
||||
{
|
||||
startMousePosition = mousePosition;
|
||||
startEulerAngles = transform.localEulerAngles;
|
||||
}
|
||||
|
||||
if ( Input.GetMouseButton( 1 ) /* right mouse */)
|
||||
{
|
||||
Vector3 offset = mousePosition - startMousePosition;
|
||||
transform.localEulerAngles = startEulerAngles + new Vector3( -offset.y * 360.0f / Screen.height, offset.x * 360.0f / Screen.width, 0.0f );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void OnGUI()
|
||||
{
|
||||
if ( showInstructions )
|
||||
{
|
||||
GUI.Label( new Rect( 10.0f, 10.0f, 600.0f, 400.0f ),
|
||||
"WASD EQ/Arrow Keys to translate the camera\n" +
|
||||
"Right mouse click to rotate the camera\n" +
|
||||
"Left mouse click for standard interactions.\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6043f3be9a21bd74281f9770463bea00
|
||||
timeCreated: 1544851962
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/SteamVR/InteractionSystem/Core/Scripts/GrabTypes.cs
Normal file
18
Assets/SteamVR/InteractionSystem/Core/Scripts/GrabTypes.cs
Normal file
@ -0,0 +1,18 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
public enum GrabTypes
|
||||
{
|
||||
None,
|
||||
Trigger,
|
||||
Pinch,
|
||||
Grip,
|
||||
Scripted,
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99eaa65760d05f74b811106b4945924e
|
||||
timeCreated: 1544851962
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1686
Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs
Normal file
1686
Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs
Normal file
File diff suppressed because it is too large
Load Diff
12
Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs.meta
Normal file
12
Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29e3e4511966ba94d8ba0b98c6c62f82
|
||||
timeCreated: 1544851963
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
284
Assets/SteamVR/InteractionSystem/Core/Scripts/HandCollider.cs
Normal file
284
Assets/SteamVR/InteractionSystem/Core/Scripts/HandCollider.cs
Normal file
@ -0,0 +1,284 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
public class HandCollider : MonoBehaviour
|
||||
{
|
||||
private new Rigidbody rigidbody;
|
||||
[HideInInspector]
|
||||
public HandPhysics hand;
|
||||
|
||||
public LayerMask collisionMask;
|
||||
|
||||
Collider[] colliders;
|
||||
|
||||
|
||||
public FingerColliders fingerColliders;
|
||||
|
||||
[System.Serializable]
|
||||
public class FingerColliders
|
||||
{
|
||||
[Tooltip("Starting at tip and going down. Max 2.")]
|
||||
public Transform[] thumbColliders = new Transform[1];
|
||||
[Tooltip("Starting at tip and going down. Max 3.")]
|
||||
public Transform[] indexColliders = new Transform[2];
|
||||
[Tooltip("Starting at tip and going down. Max 3.")]
|
||||
public Transform[] middleColliders = new Transform[2];
|
||||
[Tooltip("Starting at tip and going down. Max 3.")]
|
||||
public Transform[] ringColliders = new Transform[2];
|
||||
[Tooltip("Starting at tip and going down. Max 3.")]
|
||||
public Transform[] pinkyColliders = new Transform[2];
|
||||
|
||||
public Transform[] this[int finger]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (finger)
|
||||
{
|
||||
case 0:
|
||||
return thumbColliders;
|
||||
case 1:
|
||||
return indexColliders;
|
||||
case 2:
|
||||
return middleColliders;
|
||||
case 3:
|
||||
return ringColliders;
|
||||
case 4:
|
||||
return pinkyColliders;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (finger)
|
||||
{
|
||||
case 0:
|
||||
thumbColliders = value; break;
|
||||
case 1:
|
||||
indexColliders = value; break;
|
||||
case 2:
|
||||
middleColliders = value; break;
|
||||
case 3:
|
||||
ringColliders = value; break;
|
||||
case 4:
|
||||
pinkyColliders = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static PhysicMaterial physicMaterial_lowfriction;
|
||||
private static PhysicMaterial physicMaterial_highfriction;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
rigidbody = GetComponent<Rigidbody>();
|
||||
rigidbody.maxAngularVelocity = 50;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
colliders = GetComponentsInChildren<Collider>();
|
||||
|
||||
if (physicMaterial_lowfriction == null)
|
||||
{
|
||||
physicMaterial_lowfriction = new PhysicMaterial("hand_lowFriction");
|
||||
physicMaterial_lowfriction.dynamicFriction = 0;
|
||||
physicMaterial_lowfriction.staticFriction = 0;
|
||||
physicMaterial_lowfriction.bounciness = 0;
|
||||
physicMaterial_lowfriction.bounceCombine = PhysicMaterialCombine.Minimum;
|
||||
physicMaterial_lowfriction.frictionCombine = PhysicMaterialCombine.Minimum;
|
||||
}
|
||||
|
||||
if (physicMaterial_highfriction == null)
|
||||
{
|
||||
physicMaterial_highfriction = new PhysicMaterial("hand_highFriction");
|
||||
physicMaterial_highfriction.dynamicFriction = 1f;
|
||||
physicMaterial_highfriction.staticFriction = 1f;
|
||||
physicMaterial_highfriction.bounciness = 0;
|
||||
physicMaterial_highfriction.bounceCombine = PhysicMaterialCombine.Minimum;
|
||||
physicMaterial_highfriction.frictionCombine = PhysicMaterialCombine.Average;
|
||||
}
|
||||
|
||||
SetPhysicMaterial(physicMaterial_lowfriction);
|
||||
|
||||
scale = SteamVR_Utils.GetLossyScale(hand.transform);
|
||||
}
|
||||
|
||||
void SetPhysicMaterial(PhysicMaterial mat)
|
||||
{
|
||||
if (colliders == null) colliders = GetComponentsInChildren<Collider>();
|
||||
for (int i = 0; i < colliders.Length; i++)
|
||||
{
|
||||
colliders[i].sharedMaterial = mat;
|
||||
}
|
||||
}
|
||||
|
||||
float scale;
|
||||
|
||||
public void SetCollisionDetectionEnabled(bool value)
|
||||
{
|
||||
rigidbody.detectCollisions = value;
|
||||
}
|
||||
|
||||
public void MoveTo(Vector3 position, Quaternion rotation)
|
||||
{
|
||||
targetPosition = position;
|
||||
targetRotation = rotation;
|
||||
//rigidbody.MovePosition(position);
|
||||
//rigidbody.MoveRotation(rotation);
|
||||
|
||||
ExecuteFixedUpdate();
|
||||
}
|
||||
|
||||
public void TeleportTo(Vector3 position, Quaternion rotation)
|
||||
{
|
||||
targetPosition = position;
|
||||
targetRotation = rotation;
|
||||
|
||||
MoveTo(position, rotation);
|
||||
|
||||
rigidbody.position = position;
|
||||
|
||||
if (rotation.x != 0 || rotation.y != 0 || rotation.z != 0 || rotation.w != 0)
|
||||
rigidbody.rotation = rotation;
|
||||
|
||||
//also update transform in case physics is disabled
|
||||
transform.position = position;
|
||||
transform.rotation = rotation;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
TeleportTo(targetPosition, targetRotation);
|
||||
}
|
||||
|
||||
public void SetCenterPoint(Vector3 newCenter)
|
||||
{
|
||||
center = newCenter;
|
||||
}
|
||||
|
||||
private Vector3 center;
|
||||
|
||||
private Vector3 targetPosition = Vector3.zero;
|
||||
private Quaternion targetRotation = Quaternion.identity;
|
||||
|
||||
protected const float MaxVelocityChange = 10f;
|
||||
protected const float VelocityMagic = 6000f;
|
||||
protected const float AngularVelocityMagic = 50f;
|
||||
protected const float MaxAngularVelocityChange = 20f;
|
||||
|
||||
public bool collidersInRadius;
|
||||
protected void ExecuteFixedUpdate()
|
||||
{
|
||||
collidersInRadius = Physics.CheckSphere(center, 0.2f, collisionMask);
|
||||
if (collidersInRadius == false)
|
||||
{
|
||||
//keep updating velocity, just in case. Otherwise you get jitter
|
||||
rigidbody.velocity = Vector3.zero;
|
||||
rigidbody.angularVelocity = Vector3.zero;
|
||||
/*
|
||||
rigidbody.velocity = (targetPosition - rigidbody.position) / Time.fixedDeltaTime;
|
||||
float angle; Vector3 axis;
|
||||
(targetRotation * Quaternion.Inverse(rigidbody.rotation)).ToAngleAxis(out angle, out axis);
|
||||
rigidbody.angularVelocity = axis.normalized * angle / Time.fixedDeltaTime;
|
||||
*/
|
||||
|
||||
rigidbody.MovePosition(targetPosition);
|
||||
rigidbody.MoveRotation(targetRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 velocityTarget, angularTarget;
|
||||
bool success = GetTargetVelocities(out velocityTarget, out angularTarget);
|
||||
if (success)
|
||||
{
|
||||
float maxAngularVelocityChange = MaxAngularVelocityChange * scale;
|
||||
float maxVelocityChange = MaxVelocityChange * scale;
|
||||
|
||||
rigidbody.velocity = Vector3.MoveTowards(rigidbody.velocity, velocityTarget, maxVelocityChange);
|
||||
rigidbody.angularVelocity = Vector3.MoveTowards(rigidbody.angularVelocity, angularTarget, maxAngularVelocityChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected bool GetTargetVelocities(out Vector3 velocityTarget, out Vector3 angularTarget)
|
||||
{
|
||||
bool realNumbers = false;
|
||||
|
||||
float velocityMagic = VelocityMagic;
|
||||
float angularVelocityMagic = AngularVelocityMagic;
|
||||
|
||||
Vector3 positionDelta = (targetPosition - rigidbody.position);
|
||||
velocityTarget = (positionDelta * velocityMagic * Time.deltaTime);
|
||||
|
||||
if (float.IsNaN(velocityTarget.x) == false && float.IsInfinity(velocityTarget.x) == false)
|
||||
{
|
||||
realNumbers = true;
|
||||
}
|
||||
else
|
||||
velocityTarget = Vector3.zero;
|
||||
|
||||
|
||||
Quaternion rotationDelta = targetRotation * Quaternion.Inverse(rigidbody.rotation);
|
||||
|
||||
|
||||
float angle;
|
||||
Vector3 axis;
|
||||
rotationDelta.ToAngleAxis(out angle, out axis);
|
||||
|
||||
if (angle > 180)
|
||||
angle -= 360;
|
||||
|
||||
if (angle != 0 && float.IsNaN(axis.x) == false && float.IsInfinity(axis.x) == false)
|
||||
{
|
||||
angularTarget = angle * axis * angularVelocityMagic * Time.deltaTime;
|
||||
|
||||
realNumbers &= true;
|
||||
}
|
||||
else
|
||||
angularTarget = Vector3.zero;
|
||||
|
||||
return realNumbers;
|
||||
}
|
||||
|
||||
|
||||
const float minCollisionEnergy = 0.1f;
|
||||
const float maxCollisionEnergy = 1.0f;
|
||||
|
||||
const float minCollisionHapticsTime = 0.2f;
|
||||
private float lastCollisionHapticsTime;
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
bool touchingDynamic = false;
|
||||
if (collision.rigidbody != null)
|
||||
{
|
||||
if (collision.rigidbody.isKinematic == false) touchingDynamic = true;
|
||||
}
|
||||
|
||||
// low friction if touching static object, high friction if touching dynamic
|
||||
SetPhysicMaterial(touchingDynamic ? physicMaterial_highfriction : physicMaterial_lowfriction);
|
||||
|
||||
|
||||
|
||||
float energy = collision.relativeVelocity.magnitude;
|
||||
|
||||
if(energy > minCollisionEnergy && Time.time - lastCollisionHapticsTime > minCollisionHapticsTime)
|
||||
{
|
||||
lastCollisionHapticsTime = Time.time;
|
||||
|
||||
float intensity = Util.RemapNumber(energy, minCollisionEnergy, maxCollisionEnergy, 0.3f, 1.0f);
|
||||
float length = Util.RemapNumber(energy, minCollisionEnergy, maxCollisionEnergy, 0.0f, 0.06f);
|
||||
|
||||
hand.hand.TriggerHapticPulse(length, 100, intensity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2820b584f2917744bafbfd2f8f387225
|
||||
timeCreated: 1567795659
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
237
Assets/SteamVR/InteractionSystem/Core/Scripts/HandPhysics.cs
Normal file
237
Assets/SteamVR/InteractionSystem/Core/Scripts/HandPhysics.cs
Normal file
@ -0,0 +1,237 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: handles the physics of hands colliding with the world
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
public class HandPhysics : MonoBehaviour
|
||||
{
|
||||
[Tooltip("Hand collider prefab to instantiate")]
|
||||
public HandCollider handColliderPrefab;
|
||||
[HideInInspector]
|
||||
public HandCollider handCollider;
|
||||
|
||||
[Tooltip("Layers to consider when checking if an area is clear")]
|
||||
public LayerMask clearanceCheckMask;
|
||||
|
||||
[HideInInspector]
|
||||
public Hand hand;
|
||||
|
||||
// distance at which hand will teleport back to controller
|
||||
const float handResetDistance = 0.6f;
|
||||
|
||||
const float collisionReenableClearanceRadius = 0.1f;
|
||||
|
||||
private bool initialized = false;
|
||||
|
||||
private bool collisionsEnabled = true;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
hand = GetComponent<Hand>();
|
||||
//spawn hand collider and link it to us
|
||||
|
||||
handCollider = ((GameObject)Instantiate(handColliderPrefab.gameObject)).GetComponent<HandCollider>();
|
||||
Vector3 localPosition = handCollider.transform.localPosition;
|
||||
Quaternion localRotation = handCollider.transform.localRotation;
|
||||
|
||||
handCollider.transform.parent = Player.instance.transform;
|
||||
handCollider.transform.localPosition = localPosition;
|
||||
handCollider.transform.localRotation = localRotation;
|
||||
handCollider.hand = this;
|
||||
|
||||
GetComponent<SteamVR_Behaviour_Pose>().onTransformUpdated.AddListener(UpdateHand);
|
||||
}
|
||||
|
||||
// cached transformations
|
||||
Matrix4x4 wristToRoot;
|
||||
Matrix4x4 rootToArmature;
|
||||
Matrix4x4 wristToArmature;
|
||||
|
||||
Vector3 targetPosition = Vector3.zero;
|
||||
Quaternion targetRotation = Quaternion.identity;
|
||||
|
||||
//bones
|
||||
const int wristBone = SteamVR_Skeleton_JointIndexes.wrist;
|
||||
const int rootBone = SteamVR_Skeleton_JointIndexes.root;
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (hand.skeleton == null) return;
|
||||
initialized = true;
|
||||
|
||||
UpdateCenterPoint();
|
||||
|
||||
handCollider.MoveTo(targetPosition, targetRotation);
|
||||
|
||||
if ((handCollider.transform.position - targetPosition).sqrMagnitude > handResetDistance * handResetDistance)
|
||||
handCollider.TeleportTo(targetPosition, targetRotation);
|
||||
|
||||
UpdateFingertips();
|
||||
}
|
||||
|
||||
private void UpdateCenterPoint()
|
||||
{
|
||||
Vector3 offset = hand.skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.middleProximal) - hand.skeleton.GetBonePosition(SteamVR_Skeleton_JointIndexes.root);
|
||||
if (hand.HasSkeleton())
|
||||
{
|
||||
handCollider.SetCenterPoint(hand.skeleton.transform.position + offset);
|
||||
}
|
||||
}
|
||||
|
||||
Collider[] clearanceBuffer = new Collider[1];
|
||||
|
||||
private void UpdatePositions()
|
||||
{
|
||||
// disable collisions when holding something
|
||||
if (hand.currentAttachedObject != null)
|
||||
{
|
||||
collisionsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// wait for area to become clear before reenabling collisions
|
||||
if (!collisionsEnabled)
|
||||
{
|
||||
clearanceBuffer[0] = null;
|
||||
Physics.OverlapSphereNonAlloc(hand.objectAttachmentPoint.position, collisionReenableClearanceRadius, clearanceBuffer, clearanceCheckMask);
|
||||
// if we don't find anything in the vicinity, reenable collisions!
|
||||
if (clearanceBuffer[0] == null)
|
||||
{
|
||||
collisionsEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handCollider.SetCollisionDetectionEnabled(collisionsEnabled);
|
||||
|
||||
if (hand.skeleton == null) return;
|
||||
initialized = true;
|
||||
|
||||
// get the desired pose of the wrist in world space. Can't get the wrist bone transform, as this is affected by the resulting physics.
|
||||
|
||||
wristToRoot = Matrix4x4.TRS(ProcessPos(wristBone, hand.skeleton.GetBone(wristBone).localPosition),
|
||||
ProcessRot(wristBone, hand.skeleton.GetBone(wristBone).localRotation),
|
||||
Vector3.one).inverse;
|
||||
|
||||
rootToArmature = Matrix4x4.TRS(ProcessPos(rootBone, hand.skeleton.GetBone(rootBone).localPosition),
|
||||
ProcessRot(rootBone, hand.skeleton.GetBone(rootBone).localRotation),
|
||||
Vector3.one).inverse;
|
||||
|
||||
wristToArmature = (wristToRoot * rootToArmature).inverse;
|
||||
|
||||
// step up through virtual transform hierarchy and into world space
|
||||
targetPosition = transform.TransformPoint(wristToArmature.MultiplyPoint3x4(Vector3.zero));
|
||||
|
||||
targetRotation = transform.rotation * wristToArmature.GetRotation();
|
||||
|
||||
|
||||
//bypass physics when game paused
|
||||
if (Time.timeScale == 0)
|
||||
{
|
||||
handCollider.TeleportTo(targetPosition, targetRotation);
|
||||
}
|
||||
}
|
||||
|
||||
Transform wrist;
|
||||
|
||||
const int thumbBone = SteamVR_Skeleton_JointIndexes.thumbDistal;
|
||||
const int indexBone = SteamVR_Skeleton_JointIndexes.indexDistal;
|
||||
const int middleBone = SteamVR_Skeleton_JointIndexes.middleDistal;
|
||||
const int ringBone = SteamVR_Skeleton_JointIndexes.ringDistal;
|
||||
const int pinkyBone = SteamVR_Skeleton_JointIndexes.pinkyDistal;
|
||||
|
||||
void UpdateFingertips()
|
||||
{
|
||||
wrist = hand.skeleton.GetBone(SteamVR_Skeleton_JointIndexes.wrist);
|
||||
|
||||
// set finger tip positions in wrist space
|
||||
|
||||
for(int finger = 0; finger < 5; finger++)
|
||||
{
|
||||
int tip = SteamVR_Skeleton_JointIndexes.GetBoneForFingerTip(finger);
|
||||
int bone = tip;
|
||||
for(int i = 0; i < handCollider.fingerColliders[finger].Length; i++)
|
||||
{
|
||||
bone = tip - 1 - i; // start at distal and go down
|
||||
if (handCollider.fingerColliders[finger][i] != null)
|
||||
handCollider.fingerColliders[finger][i].localPosition = wrist.InverseTransformPoint(hand.skeleton.GetBone(bone).position);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(handCollider.tip_thumb != null)
|
||||
handCollider.tip_thumb.localPosition = wrist.InverseTransformPoint(hand.skeleton.GetBone(thumbBone).position);
|
||||
|
||||
if(handCollider.tip_index != null)
|
||||
handCollider.tip_index.localPosition = wrist.InverseTransformPoint(hand.skeleton.GetBone(indexBone).position);
|
||||
|
||||
if(handCollider.tip_middle != null)
|
||||
handCollider.tip_middle.localPosition = wrist.InverseTransformPoint(hand.skeleton.GetBone(middleBone).position);
|
||||
|
||||
if(handCollider.tip_ring != null)
|
||||
handCollider.tip_ring.localPosition = wrist.InverseTransformPoint(hand.skeleton.GetBone(ringBone).position);
|
||||
|
||||
if (handCollider.tip_pinky != null)
|
||||
handCollider.tip_pinky.localPosition = wrist.InverseTransformPoint(hand.skeleton.GetBone(pinkyBone).position);
|
||||
*/
|
||||
}
|
||||
|
||||
void UpdateHand(SteamVR_Behaviour_Pose pose, SteamVR_Input_Sources inputSource)
|
||||
{
|
||||
if (!initialized) return;
|
||||
|
||||
UpdateCenterPoint();
|
||||
|
||||
UpdatePositions();
|
||||
|
||||
Quaternion offsetRotation = handCollider.transform.rotation * wristToArmature.inverse.GetRotation();
|
||||
|
||||
hand.mainRenderModel.transform.rotation = offsetRotation;
|
||||
|
||||
Vector3 offsetPosition = handCollider.transform.TransformPoint(wristToArmature.inverse.MultiplyPoint3x4(Vector3.zero));
|
||||
|
||||
hand.mainRenderModel.transform.position = offsetPosition;
|
||||
|
||||
/*
|
||||
Vector3 wristPointInArmatureSpace = transform.InverseTransformPoint(handCollider.transform.position);
|
||||
|
||||
Vector3 handTargetPosition =
|
||||
|
||||
hand.mainRenderModel.transform.position = handTargetPosition;
|
||||
|
||||
//Quaternion handTargetRotation = transform.rotation * (wristToArmature.inverse.rotation * (Quaternion.Inverse(transform.rotation) * handCollider.transform.rotation));
|
||||
|
||||
//hand.mainRenderModel.transform.rotation = handTargetRotation;
|
||||
*/
|
||||
}
|
||||
|
||||
Vector3 ProcessPos(int boneIndex, Vector3 pos)
|
||||
{
|
||||
if(hand.skeleton.mirroring != SteamVR_Behaviour_Skeleton.MirrorType.None)
|
||||
{
|
||||
return SteamVR_Behaviour_Skeleton.MirrorPosition(boneIndex, pos);
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
Quaternion ProcessRot(int boneIndex, Quaternion rot)
|
||||
{
|
||||
if (hand.skeleton.mirroring != SteamVR_Behaviour_Skeleton.MirrorType.None)
|
||||
{
|
||||
return SteamVR_Behaviour_Skeleton.MirrorRotation(boneIndex, rot);
|
||||
}
|
||||
|
||||
return rot;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e75fe4b0c190eb4ba97e59f062510e9
|
||||
timeCreated: 1567795659
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
83
Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs
Normal file
83
Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs
Normal file
@ -0,0 +1,83 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Triggers haptic pulses based on a linear mapping
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( Interactable ) )]
|
||||
public class HapticRack : MonoBehaviour
|
||||
{
|
||||
[Tooltip( "The linear mapping driving the haptic rack" )]
|
||||
public LinearMapping linearMapping;
|
||||
|
||||
[Tooltip( "The number of haptic pulses evenly distributed along the mapping" )]
|
||||
public int teethCount = 128;
|
||||
|
||||
[Tooltip( "Minimum duration of the haptic pulse" )]
|
||||
public int minimumPulseDuration = 500;
|
||||
|
||||
[Tooltip( "Maximum duration of the haptic pulse" )]
|
||||
public int maximumPulseDuration = 900;
|
||||
|
||||
[Tooltip( "This event is triggered every time a haptic pulse is made" )]
|
||||
public UnityEvent onPulse;
|
||||
|
||||
private Hand hand;
|
||||
private int previousToothIndex = -1;
|
||||
|
||||
//-------------------------------------------------
|
||||
void Awake()
|
||||
{
|
||||
if ( linearMapping == null )
|
||||
{
|
||||
linearMapping = GetComponent<LinearMapping>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverBegin( Hand hand )
|
||||
{
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverEnd( Hand hand )
|
||||
{
|
||||
this.hand = null;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
void Update()
|
||||
{
|
||||
int currentToothIndex = Mathf.RoundToInt( linearMapping.value * teethCount - 0.5f );
|
||||
if ( currentToothIndex != previousToothIndex )
|
||||
{
|
||||
Pulse();
|
||||
previousToothIndex = currentToothIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void Pulse()
|
||||
{
|
||||
if ( hand && (hand.isActive) && ( hand.GetBestGrabbingType() != GrabTypes.None ) )
|
||||
{
|
||||
ushort duration = (ushort)Random.Range( minimumPulseDuration, maximumPulseDuration + 1 );
|
||||
hand.TriggerHapticPulse( duration );
|
||||
|
||||
onPulse.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 817521c5973e4ee45905ee97df3c38ad
|
||||
timeCreated: 1544851962
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,21 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Sets this GameObject as inactive when it loses focus from the hand
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class HideOnHandFocusLost : MonoBehaviour
|
||||
{
|
||||
//-------------------------------------------------
|
||||
private void OnHandFocusLost( Hand hand )
|
||||
{
|
||||
gameObject.SetActive( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb6d6653511aff5409d0827d4e3b79ea
|
||||
timeCreated: 1544851962
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
111
Assets/SteamVR/InteractionSystem/Core/Scripts/HoverButton.cs
Normal file
111
Assets/SteamVR/InteractionSystem/Core/Scripts/HoverButton.cs
Normal file
@ -0,0 +1,111 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Drives a linear mapping based on position between 2 positions
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent(typeof(Interactable))]
|
||||
public class HoverButton : MonoBehaviour
|
||||
{
|
||||
public Transform movingPart;
|
||||
|
||||
public Vector3 localMoveDistance = new Vector3(0, -0.1f, 0);
|
||||
|
||||
[Range(0, 1)]
|
||||
public float engageAtPercent = 0.95f;
|
||||
|
||||
[Range(0, 1)]
|
||||
public float disengageAtPercent = 0.9f;
|
||||
|
||||
public HandEvent onButtonDown;
|
||||
public HandEvent onButtonUp;
|
||||
public HandEvent onButtonIsPressed;
|
||||
|
||||
public bool engaged = false;
|
||||
public bool buttonDown = false;
|
||||
public bool buttonUp = false;
|
||||
|
||||
private Vector3 startPosition;
|
||||
private Vector3 endPosition;
|
||||
|
||||
private Vector3 handEnteredPosition;
|
||||
|
||||
private bool hovering;
|
||||
|
||||
private Hand lastHoveredHand;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (movingPart == null && this.transform.childCount > 0)
|
||||
movingPart = this.transform.GetChild(0);
|
||||
|
||||
startPosition = movingPart.localPosition;
|
||||
endPosition = startPosition + localMoveDistance;
|
||||
handEnteredPosition = endPosition;
|
||||
}
|
||||
|
||||
private void HandHoverUpdate(Hand hand)
|
||||
{
|
||||
hovering = true;
|
||||
lastHoveredHand = hand;
|
||||
|
||||
bool wasEngaged = engaged;
|
||||
|
||||
float currentDistance = Vector3.Distance(movingPart.parent.InverseTransformPoint(hand.transform.position), endPosition);
|
||||
float enteredDistance = Vector3.Distance(handEnteredPosition, endPosition);
|
||||
|
||||
if (currentDistance > enteredDistance)
|
||||
{
|
||||
enteredDistance = currentDistance;
|
||||
handEnteredPosition = movingPart.parent.InverseTransformPoint(hand.transform.position);
|
||||
}
|
||||
|
||||
float distanceDifference = enteredDistance - currentDistance;
|
||||
|
||||
float lerp = Mathf.InverseLerp(0, localMoveDistance.magnitude, distanceDifference);
|
||||
|
||||
if (lerp > engageAtPercent)
|
||||
engaged = true;
|
||||
else if (lerp < disengageAtPercent)
|
||||
engaged = false;
|
||||
|
||||
movingPart.localPosition = Vector3.Lerp(startPosition, endPosition, lerp);
|
||||
|
||||
InvokeEvents(wasEngaged, engaged);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (hovering == false)
|
||||
{
|
||||
movingPart.localPosition = startPosition;
|
||||
handEnteredPosition = endPosition;
|
||||
|
||||
InvokeEvents(engaged, false);
|
||||
engaged = false;
|
||||
}
|
||||
|
||||
hovering = false;
|
||||
}
|
||||
|
||||
private void InvokeEvents(bool wasEngaged, bool isEngaged)
|
||||
{
|
||||
buttonDown = wasEngaged == false && isEngaged == true;
|
||||
buttonUp = wasEngaged == true && isEngaged == false;
|
||||
|
||||
if (buttonDown && onButtonDown != null)
|
||||
onButtonDown.Invoke(lastHoveredHand);
|
||||
if (buttonUp && onButtonUp != null)
|
||||
onButtonUp.Invoke(lastHoveredHand);
|
||||
if (isEngaged && onButtonIsPressed != null)
|
||||
onButtonIsPressed.Invoke(lastHoveredHand);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c0e35ef0cc211b408d2d7e7eb0f850d
|
||||
timeCreated: 1544851963
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,17 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Makes this object ignore any hovering by the hands
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class IgnoreHovering : MonoBehaviour
|
||||
{
|
||||
[Tooltip( "If Hand is not null, only ignore the specified hand" )]
|
||||
public Hand onlyIgnoreHand = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5a1be5da1c87864582d778e52de4e9b
|
||||
timeCreated: 1544851963
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
83
Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs
Normal file
83
Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs
Normal file
@ -0,0 +1,83 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Makes the hand act as an input module for Unity's event system
|
||||
//
|
||||
//=============================================================================
|
||||
#if UNITY_UGUI_UI || !UNITY_2019_2_OR_NEWER
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class InputModule : BaseInputModule
|
||||
{
|
||||
private GameObject submitObject;
|
||||
|
||||
//-------------------------------------------------
|
||||
private static InputModule _instance;
|
||||
public static InputModule instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _instance == null )
|
||||
_instance = GameObject.FindObjectOfType<InputModule>();
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
public override bool ShouldActivateModule()
|
||||
{
|
||||
if ( !base.ShouldActivateModule() )
|
||||
return false;
|
||||
|
||||
return submitObject != null;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
public void HoverBegin( GameObject gameObject )
|
||||
{
|
||||
PointerEventData pointerEventData = new PointerEventData( eventSystem );
|
||||
ExecuteEvents.Execute( gameObject, pointerEventData, ExecuteEvents.pointerEnterHandler );
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
public void HoverEnd( GameObject gameObject )
|
||||
{
|
||||
PointerEventData pointerEventData = new PointerEventData( eventSystem );
|
||||
pointerEventData.selectedObject = null;
|
||||
ExecuteEvents.Execute( gameObject, pointerEventData, ExecuteEvents.pointerExitHandler );
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
public void Submit( GameObject gameObject )
|
||||
{
|
||||
submitObject = gameObject;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
public override void Process()
|
||||
{
|
||||
if ( submitObject )
|
||||
{
|
||||
BaseEventData data = GetBaseEventData();
|
||||
data.selectedObject = submitObject;
|
||||
ExecuteEvents.Execute( submitObject, data, ExecuteEvents.submitHandler );
|
||||
|
||||
submitObject = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else //if we haven't run the xr install script yet use this
|
||||
using UnityEngine;
|
||||
namespace Valve.VR.InteractionSystem { public class InputModule : MonoBehaviour {} }
|
||||
#endif
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9e05292e0d62b542ac5bba92674a86d
|
||||
timeCreated: 1544851963
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
371
Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs
Normal file
371
Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs
Normal file
@ -0,0 +1,371 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: This object will get hover events and can be attached to the hands
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class Interactable : MonoBehaviour
|
||||
{
|
||||
[Tooltip("Activates an action set on attach and deactivates on detach")]
|
||||
public SteamVR_ActionSet activateActionSetOnAttach;
|
||||
|
||||
[Tooltip("Hide the whole hand on attachment and show on detach")]
|
||||
public bool hideHandOnAttach = true;
|
||||
|
||||
[Tooltip("Hide the skeleton part of the hand on attachment and show on detach")]
|
||||
public bool hideSkeletonOnAttach = false;
|
||||
|
||||
[Tooltip("Hide the controller part of the hand on attachment and show on detach")]
|
||||
public bool hideControllerOnAttach = false;
|
||||
|
||||
[Tooltip("The integer in the animator to trigger on pickup. 0 for none")]
|
||||
public int handAnimationOnPickup = 0;
|
||||
|
||||
[Tooltip("The range of motion to set on the skeleton. None for no change.")]
|
||||
public SkeletalMotionRangeChange setRangeOfMotionOnPickup = SkeletalMotionRangeChange.None;
|
||||
|
||||
public delegate void OnAttachedToHandDelegate(Hand hand);
|
||||
public delegate void OnDetachedFromHandDelegate(Hand hand);
|
||||
|
||||
public event OnAttachedToHandDelegate onAttachedToHand;
|
||||
public event OnDetachedFromHandDelegate onDetachedFromHand;
|
||||
|
||||
|
||||
[Tooltip("Specify whether you want to snap to the hand's object attachment point, or just the raw hand")]
|
||||
public bool useHandObjectAttachmentPoint = true;
|
||||
|
||||
public bool attachEaseIn = false;
|
||||
[HideInInspector]
|
||||
public AnimationCurve snapAttachEaseInCurve = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
public float snapAttachEaseInTime = 0.15f;
|
||||
|
||||
public bool snapAttachEaseInCompleted = false;
|
||||
|
||||
|
||||
// [Tooltip("The skeleton pose to apply when grabbing. Can only set this or handFollowTransform.")]
|
||||
[HideInInspector]
|
||||
public SteamVR_Skeleton_Poser skeletonPoser;
|
||||
|
||||
[Tooltip("Should the rendered hand lock on to and follow the object")]
|
||||
public bool handFollowTransform= true;
|
||||
|
||||
|
||||
[Tooltip("Set whether or not you want this interactible to highlight when hovering over it")]
|
||||
public bool highlightOnHover = true;
|
||||
protected MeshRenderer[] highlightRenderers;
|
||||
protected MeshRenderer[] existingRenderers;
|
||||
protected GameObject highlightHolder;
|
||||
protected SkinnedMeshRenderer[] highlightSkinnedRenderers;
|
||||
protected SkinnedMeshRenderer[] existingSkinnedRenderers;
|
||||
protected static Material highlightMat;
|
||||
[Tooltip("An array of child gameObjects to not render a highlight for. Things like transparent parts, vfx, etc.")]
|
||||
public GameObject[] hideHighlight = new GameObject[] { };
|
||||
|
||||
[Tooltip("Higher is better")]
|
||||
public int hoverPriority = 0;
|
||||
|
||||
[System.NonSerialized]
|
||||
public Hand attachedToHand;
|
||||
|
||||
[System.NonSerialized]
|
||||
public List<Hand> hoveringHands = new List<Hand>();
|
||||
public Hand hoveringHand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (hoveringHands.Count > 0)
|
||||
return hoveringHands[0];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool isDestroying { get; protected set; }
|
||||
public bool isHovering { get; protected set; }
|
||||
public bool wasHovering { get; protected set; }
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
skeletonPoser = GetComponent<SteamVR_Skeleton_Poser>();
|
||||
}
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
if (highlightMat == null)
|
||||
#if UNITY_URP
|
||||
highlightMat = (Material)Resources.Load("SteamVR_HoverHighlight_URP", typeof(Material));
|
||||
#else
|
||||
highlightMat = (Material)Resources.Load("SteamVR_HoverHighlight", typeof(Material));
|
||||
#endif
|
||||
|
||||
if (highlightMat == null)
|
||||
Debug.LogError("<b>[SteamVR Interaction]</b> Hover Highlight Material is missing. Please create a material named 'SteamVR_HoverHighlight' and place it in a Resources folder", this);
|
||||
|
||||
if (skeletonPoser != null)
|
||||
{
|
||||
if (useHandObjectAttachmentPoint)
|
||||
{
|
||||
//Debug.LogWarning("<b>[SteamVR Interaction]</b> SkeletonPose and useHandObjectAttachmentPoint both set at the same time. Ignoring useHandObjectAttachmentPoint.");
|
||||
useHandObjectAttachmentPoint = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool ShouldIgnoreHighlight(Component component)
|
||||
{
|
||||
return ShouldIgnore(component.gameObject);
|
||||
}
|
||||
|
||||
protected virtual bool ShouldIgnore(GameObject check)
|
||||
{
|
||||
for (int ignoreIndex = 0; ignoreIndex < hideHighlight.Length; ignoreIndex++)
|
||||
{
|
||||
if (check == hideHighlight[ignoreIndex])
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual void CreateHighlightRenderers()
|
||||
{
|
||||
existingSkinnedRenderers = this.GetComponentsInChildren<SkinnedMeshRenderer>(true);
|
||||
highlightHolder = new GameObject("Highlighter");
|
||||
highlightSkinnedRenderers = new SkinnedMeshRenderer[existingSkinnedRenderers.Length];
|
||||
|
||||
for (int skinnedIndex = 0; skinnedIndex < existingSkinnedRenderers.Length; skinnedIndex++)
|
||||
{
|
||||
SkinnedMeshRenderer existingSkinned = existingSkinnedRenderers[skinnedIndex];
|
||||
|
||||
if (ShouldIgnoreHighlight(existingSkinned))
|
||||
continue;
|
||||
|
||||
GameObject newSkinnedHolder = new GameObject("SkinnedHolder");
|
||||
newSkinnedHolder.transform.parent = highlightHolder.transform;
|
||||
SkinnedMeshRenderer newSkinned = newSkinnedHolder.AddComponent<SkinnedMeshRenderer>();
|
||||
Material[] materials = new Material[existingSkinned.sharedMaterials.Length];
|
||||
for (int materialIndex = 0; materialIndex < materials.Length; materialIndex++)
|
||||
{
|
||||
materials[materialIndex] = highlightMat;
|
||||
}
|
||||
|
||||
newSkinned.sharedMaterials = materials;
|
||||
newSkinned.sharedMesh = existingSkinned.sharedMesh;
|
||||
newSkinned.rootBone = existingSkinned.rootBone;
|
||||
newSkinned.updateWhenOffscreen = existingSkinned.updateWhenOffscreen;
|
||||
newSkinned.bones = existingSkinned.bones;
|
||||
|
||||
highlightSkinnedRenderers[skinnedIndex] = newSkinned;
|
||||
}
|
||||
|
||||
MeshFilter[] existingFilters = this.GetComponentsInChildren<MeshFilter>(true);
|
||||
existingRenderers = new MeshRenderer[existingFilters.Length];
|
||||
highlightRenderers = new MeshRenderer[existingFilters.Length];
|
||||
|
||||
for (int filterIndex = 0; filterIndex < existingFilters.Length; filterIndex++)
|
||||
{
|
||||
MeshFilter existingFilter = existingFilters[filterIndex];
|
||||
MeshRenderer existingRenderer = existingFilter.GetComponent<MeshRenderer>();
|
||||
|
||||
if (existingFilter == null || existingRenderer == null || ShouldIgnoreHighlight(existingFilter))
|
||||
continue;
|
||||
|
||||
GameObject newFilterHolder = new GameObject("FilterHolder");
|
||||
newFilterHolder.transform.parent = highlightHolder.transform;
|
||||
MeshFilter newFilter = newFilterHolder.AddComponent<MeshFilter>();
|
||||
newFilter.sharedMesh = existingFilter.sharedMesh;
|
||||
MeshRenderer newRenderer = newFilterHolder.AddComponent<MeshRenderer>();
|
||||
|
||||
Material[] materials = new Material[existingRenderer.sharedMaterials.Length];
|
||||
for (int materialIndex = 0; materialIndex < materials.Length; materialIndex++)
|
||||
{
|
||||
materials[materialIndex] = highlightMat;
|
||||
}
|
||||
newRenderer.sharedMaterials = materials;
|
||||
|
||||
highlightRenderers[filterIndex] = newRenderer;
|
||||
existingRenderers[filterIndex] = existingRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateHighlightRenderers()
|
||||
{
|
||||
if (highlightHolder == null)
|
||||
return;
|
||||
|
||||
for (int skinnedIndex = 0; skinnedIndex < existingSkinnedRenderers.Length; skinnedIndex++)
|
||||
{
|
||||
SkinnedMeshRenderer existingSkinned = existingSkinnedRenderers[skinnedIndex];
|
||||
SkinnedMeshRenderer highlightSkinned = highlightSkinnedRenderers[skinnedIndex];
|
||||
|
||||
if (existingSkinned != null && highlightSkinned != null && attachedToHand == false)
|
||||
{
|
||||
highlightSkinned.transform.position = existingSkinned.transform.position;
|
||||
highlightSkinned.transform.rotation = existingSkinned.transform.rotation;
|
||||
highlightSkinned.transform.localScale = existingSkinned.transform.lossyScale;
|
||||
highlightSkinned.localBounds = existingSkinned.localBounds;
|
||||
highlightSkinned.enabled = isHovering && existingSkinned.enabled && existingSkinned.gameObject.activeInHierarchy;
|
||||
|
||||
int blendShapeCount = existingSkinned.sharedMesh.blendShapeCount;
|
||||
for (int blendShapeIndex = 0; blendShapeIndex < blendShapeCount; blendShapeIndex++)
|
||||
{
|
||||
highlightSkinned.SetBlendShapeWeight(blendShapeIndex, existingSkinned.GetBlendShapeWeight(blendShapeIndex));
|
||||
}
|
||||
}
|
||||
else if (highlightSkinned != null)
|
||||
highlightSkinned.enabled = false;
|
||||
|
||||
}
|
||||
|
||||
for (int rendererIndex = 0; rendererIndex < highlightRenderers.Length; rendererIndex++)
|
||||
{
|
||||
MeshRenderer existingRenderer = existingRenderers[rendererIndex];
|
||||
MeshRenderer highlightRenderer = highlightRenderers[rendererIndex];
|
||||
|
||||
if (existingRenderer != null && highlightRenderer != null && attachedToHand == false)
|
||||
{
|
||||
highlightRenderer.transform.position = existingRenderer.transform.position;
|
||||
highlightRenderer.transform.rotation = existingRenderer.transform.rotation;
|
||||
highlightRenderer.transform.localScale = existingRenderer.transform.lossyScale;
|
||||
highlightRenderer.enabled = isHovering && existingRenderer.enabled && existingRenderer.gameObject.activeInHierarchy;
|
||||
}
|
||||
else if (highlightRenderer != null)
|
||||
highlightRenderer.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a Hand starts hovering over this object
|
||||
/// </summary>
|
||||
protected virtual void OnHandHoverBegin(Hand hand)
|
||||
{
|
||||
wasHovering = isHovering;
|
||||
isHovering = true;
|
||||
|
||||
hoveringHands.Add(hand);
|
||||
|
||||
if (highlightOnHover == true && wasHovering == false)
|
||||
{
|
||||
CreateHighlightRenderers();
|
||||
UpdateHighlightRenderers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when a Hand stops hovering over this object
|
||||
/// </summary>
|
||||
protected virtual void OnHandHoverEnd(Hand hand)
|
||||
{
|
||||
wasHovering = isHovering;
|
||||
|
||||
hoveringHands.Remove(hand);
|
||||
|
||||
if (hoveringHands.Count == 0)
|
||||
{
|
||||
isHovering = false;
|
||||
|
||||
if (highlightOnHover && highlightHolder != null)
|
||||
Destroy(highlightHolder);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (highlightOnHover)
|
||||
{
|
||||
UpdateHighlightRenderers();
|
||||
|
||||
if (isHovering == false && highlightHolder != null)
|
||||
Destroy(highlightHolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected float blendToPoseTime = 0.1f;
|
||||
protected float releasePoseBlendTime = 0.2f;
|
||||
|
||||
protected virtual void OnAttachedToHand(Hand hand)
|
||||
{
|
||||
if (activateActionSetOnAttach != null)
|
||||
activateActionSetOnAttach.Activate(hand.handType);
|
||||
|
||||
if (onAttachedToHand != null)
|
||||
{
|
||||
onAttachedToHand.Invoke(hand);
|
||||
}
|
||||
|
||||
if (skeletonPoser != null && hand.skeleton != null)
|
||||
{
|
||||
hand.skeleton.BlendToPoser(skeletonPoser, blendToPoseTime);
|
||||
}
|
||||
|
||||
attachedToHand = hand;
|
||||
}
|
||||
|
||||
protected virtual void OnDetachedFromHand(Hand hand)
|
||||
{
|
||||
if (activateActionSetOnAttach != null)
|
||||
{
|
||||
if (hand.otherHand == null || hand.otherHand.currentAttachedObjectInfo.HasValue == false ||
|
||||
(hand.otherHand.currentAttachedObjectInfo.Value.interactable != null &&
|
||||
hand.otherHand.currentAttachedObjectInfo.Value.interactable.activateActionSetOnAttach != this.activateActionSetOnAttach))
|
||||
{
|
||||
activateActionSetOnAttach.Deactivate(hand.handType);
|
||||
}
|
||||
}
|
||||
|
||||
if (onDetachedFromHand != null)
|
||||
{
|
||||
onDetachedFromHand.Invoke(hand);
|
||||
}
|
||||
|
||||
|
||||
if (skeletonPoser != null)
|
||||
{
|
||||
if (hand.skeleton != null)
|
||||
hand.skeleton.BlendToSkeleton(releasePoseBlendTime);
|
||||
}
|
||||
|
||||
attachedToHand = null;
|
||||
}
|
||||
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
isDestroying = true;
|
||||
|
||||
if (attachedToHand != null)
|
||||
{
|
||||
attachedToHand.DetachObject(this.gameObject, false);
|
||||
attachedToHand.skeleton.BlendToSkeleton(0.1f);
|
||||
}
|
||||
|
||||
if (highlightHolder != null)
|
||||
Destroy(highlightHolder);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
isDestroying = true;
|
||||
|
||||
if (attachedToHand != null)
|
||||
{
|
||||
attachedToHand.ForceHoverUnlock();
|
||||
}
|
||||
|
||||
if (highlightHolder != null)
|
||||
Destroy(highlightHolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b93b6a877adcbf94c89a9d6e0c0e844d
|
||||
timeCreated: 1544851963
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,201 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: This object will get hover events and can be attached to the hands
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
public class InteractableDebug : MonoBehaviour
|
||||
{
|
||||
[System.NonSerialized]
|
||||
public Hand attachedToHand;
|
||||
|
||||
public float simulateReleasesForXSecondsAroundRelease = 0;
|
||||
public float simulateReleasesEveryXSeconds = 0.005f;
|
||||
public bool setPositionsForSimulations = false;
|
||||
|
||||
private Renderer[] selfRenderers;
|
||||
|
||||
private Collider[] colliders;
|
||||
|
||||
private Color lastColor;
|
||||
|
||||
private Throwable throwable;
|
||||
private bool isThrowable { get { return throwable != null; } }
|
||||
|
||||
private const bool onlyColorOnChange = true;
|
||||
|
||||
public new Rigidbody rigidbody;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
selfRenderers = this.GetComponentsInChildren<Renderer>();
|
||||
throwable = this.GetComponent<Throwable>();
|
||||
rigidbody = this.GetComponent<Rigidbody>();
|
||||
colliders = this.GetComponentsInChildren<Collider>();
|
||||
}
|
||||
|
||||
private void OnAttachedToHand( Hand hand )
|
||||
{
|
||||
attachedToHand = hand;
|
||||
|
||||
CreateMarker(Color.green);
|
||||
}
|
||||
|
||||
|
||||
protected virtual void HandAttachedUpdate(Hand hand)
|
||||
{
|
||||
Color grabbedColor;
|
||||
switch (hand.currentAttachedObjectInfo.Value.grabbedWithType)
|
||||
{
|
||||
case GrabTypes.Grip:
|
||||
grabbedColor = Color.blue;
|
||||
break;
|
||||
case GrabTypes.Pinch:
|
||||
grabbedColor = Color.green;
|
||||
break;
|
||||
case GrabTypes.Trigger:
|
||||
grabbedColor = Color.yellow;
|
||||
break;
|
||||
case GrabTypes.Scripted:
|
||||
grabbedColor = Color.red;
|
||||
break;
|
||||
case GrabTypes.None:
|
||||
default:
|
||||
grabbedColor = Color.white;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((onlyColorOnChange && grabbedColor != lastColor) || onlyColorOnChange == false)
|
||||
ColorSelf(grabbedColor);
|
||||
|
||||
lastColor = grabbedColor;
|
||||
}
|
||||
|
||||
|
||||
private void OnDetachedFromHand( Hand hand )
|
||||
{
|
||||
if (isThrowable)
|
||||
{
|
||||
Vector3 velocity;
|
||||
Vector3 angularVelocity;
|
||||
|
||||
throwable.GetReleaseVelocities(hand, out velocity, out angularVelocity);
|
||||
|
||||
CreateMarker(Color.cyan, velocity.normalized);
|
||||
}
|
||||
|
||||
CreateMarker(Color.red);
|
||||
attachedToHand = null;
|
||||
|
||||
if (isSimulation == false && simulateReleasesForXSecondsAroundRelease != 0)
|
||||
{
|
||||
float startTime = -simulateReleasesForXSecondsAroundRelease;
|
||||
float endTime = simulateReleasesForXSecondsAroundRelease;
|
||||
|
||||
List<InteractableDebug> list = new List<InteractableDebug>();
|
||||
list.Add(this);
|
||||
|
||||
for (float offset = startTime; offset <= endTime; offset += simulateReleasesEveryXSeconds)
|
||||
{
|
||||
float lerp = Mathf.InverseLerp(startTime, endTime, offset);
|
||||
InteractableDebug copy = CreateSimulation(hand, offset, Color.Lerp(Color.red, Color.green, lerp));
|
||||
list.Add(copy);
|
||||
}
|
||||
|
||||
for (int index = 0; index < list.Count; index++)
|
||||
{
|
||||
for (int otherIndex = 0; otherIndex < list.Count; otherIndex++)
|
||||
{
|
||||
list[index].IgnoreObject(list[otherIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Collider[] GetColliders()
|
||||
{
|
||||
return colliders;
|
||||
}
|
||||
|
||||
public void IgnoreObject(InteractableDebug otherInteractable)
|
||||
{
|
||||
Collider[] otherColliders = otherInteractable.GetColliders();
|
||||
|
||||
for (int myIndex = 0; myIndex < colliders.Length; myIndex++)
|
||||
{
|
||||
for (int otherIndex = 0; otherIndex < otherColliders.Length; otherIndex++)
|
||||
{
|
||||
Physics.IgnoreCollision(colliders[myIndex], otherColliders[otherIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isSimulation = false;
|
||||
public void SetIsSimulation()
|
||||
{
|
||||
isSimulation = true;
|
||||
}
|
||||
|
||||
private InteractableDebug CreateSimulation(Hand fromHand, float timeOffset, Color copyColor)
|
||||
{
|
||||
GameObject copy = GameObject.Instantiate(this.gameObject);
|
||||
InteractableDebug debugCopy = copy.GetComponent<InteractableDebug>();
|
||||
debugCopy.SetIsSimulation();
|
||||
debugCopy.ColorSelf(copyColor);
|
||||
copy.name = string.Format("{0} [offset: {1:0.000}]", copy.name, timeOffset);
|
||||
|
||||
Vector3 velocity = fromHand.GetTrackedObjectVelocity(timeOffset);
|
||||
velocity *= throwable.scaleReleaseVelocity;
|
||||
|
||||
debugCopy.rigidbody.velocity = velocity;
|
||||
|
||||
return debugCopy;
|
||||
}
|
||||
|
||||
private void CreateMarker(Color markerColor, float destroyAfter = 10)
|
||||
{
|
||||
CreateMarker(markerColor, attachedToHand.GetTrackedObjectVelocity().normalized, destroyAfter);
|
||||
}
|
||||
|
||||
private void CreateMarker(Color markerColor, Vector3 forward, float destroyAfter = 10)
|
||||
{
|
||||
GameObject baseMarker = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
DestroyImmediate(baseMarker.GetComponent<Collider>());
|
||||
baseMarker.transform.localScale = new Vector3(0.02f, 0.02f, 0.02f);
|
||||
|
||||
GameObject line = GameObject.Instantiate(baseMarker);
|
||||
line.transform.localScale = new Vector3(0.01f, 0.01f, 0.25f);
|
||||
line.transform.parent = baseMarker.transform;
|
||||
line.transform.localPosition = new Vector3(0, 0, line.transform.localScale.z / 2f);
|
||||
|
||||
baseMarker.transform.position = attachedToHand.transform.position;
|
||||
baseMarker.transform.forward = forward;
|
||||
|
||||
ColorThing(markerColor, baseMarker.GetComponentsInChildren<Renderer>());
|
||||
|
||||
if (destroyAfter > 0)
|
||||
Destroy(baseMarker, destroyAfter);
|
||||
}
|
||||
|
||||
private void ColorSelf(Color newColor)
|
||||
{
|
||||
ColorThing(newColor, selfRenderers);
|
||||
}
|
||||
|
||||
private void ColorThing(Color newColor, Renderer[] renderers)
|
||||
{
|
||||
for (int rendererIndex = 0; rendererIndex < renderers.Length; rendererIndex++)
|
||||
{
|
||||
renderers[rendererIndex].material.color = newColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78549ac336d4d37418a4d4e0d981f91f
|
||||
timeCreated: 1544851963
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,49 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Sends UnityEvents for basic hand interactions
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
[RequireComponent( typeof( Interactable ) )]
|
||||
public class InteractableHoverEvents : MonoBehaviour
|
||||
{
|
||||
public UnityEvent onHandHoverBegin;
|
||||
public UnityEvent onHandHoverEnd;
|
||||
public UnityEvent onAttachedToHand;
|
||||
public UnityEvent onDetachedFromHand;
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverBegin()
|
||||
{
|
||||
onHandHoverBegin.Invoke();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnHandHoverEnd()
|
||||
{
|
||||
onHandHoverEnd.Invoke();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnAttachedToHand( Hand hand )
|
||||
{
|
||||
onAttachedToHand.Invoke();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
private void OnDetachedFromHand( Hand hand )
|
||||
{
|
||||
onDetachedFromHand.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4153b26428ccf041950b92c057812a3
|
||||
timeCreated: 1544852179
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user