Updated oculus stuff

This commit is contained in:
Chris Midkiff
2018-10-09 20:59:57 -04:00
parent 1e7362c19f
commit 9b7f63739e
957 changed files with 128988 additions and 588 deletions

View File

@@ -0,0 +1,771 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 1
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &8653650
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 8653655}
- component: {fileID: 8653654}
- component: {fileID: 8653653}
- component: {fileID: 8653652}
- component: {fileID: 8653651}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &8653651
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 8653650}
m_Enabled: 0
--- !u!124 &8653652
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 8653650}
m_Enabled: 1
--- !u!92 &8653653
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 8653650}
m_Enabled: 1
--- !u!20 &8653654
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 8653650}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &8653655
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 8653650}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &206856059
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 206856064}
- component: {fileID: 206856063}
- component: {fileID: 206856062}
- component: {fileID: 206856061}
- component: {fileID: 206856060}
m_Layer: 0
m_Name: RoomCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &206856060
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 206856059}
m_Enabled: 1
--- !u!92 &206856061
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 206856059}
m_Enabled: 1
--- !u!124 &206856062
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 206856059}
m_Enabled: 1
--- !u!20 &206856063
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 206856059}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &206856064
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 206856059}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 3, z: -9.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &780482174
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 780482176}
- component: {fileID: 780482175}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &780482175
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 780482174}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &780482176
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 780482174}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &840719025
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 840719029}
- component: {fileID: 840719028}
- component: {fileID: 840719027}
- component: {fileID: 840719026}
m_Layer: 0
m_Name: HelpPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &840719026
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 840719025}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 4c18da23435024b43a2b78449cbb6ed0, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!64 &840719027
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 840719025}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_SkinWidth: 0.01
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &840719028
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 840719025}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &840719029
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 840719025}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1390249324
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 100014, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_TagString
value: MainCamera
objectReference: {fileID: 0}
- target: {fileID: 100010, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: m_TagString
value: MainCamera
objectReference: {fileID: 0}
- target: {fileID: 11400002, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
propertyPath: _trackingOriginType
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1390249325 stripped
GameObject:
m_PrefabParentObject: {fileID: 100014, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
m_PrefabInternal: {fileID: 1390249324}
--- !u!1 &1390249326 stripped
GameObject:
m_PrefabParentObject: {fileID: 100010, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
m_PrefabInternal: {fileID: 1390249324}
--- !u!20 &1390249327
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1390249325}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 2
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!20 &1390249328
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1390249326}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 1
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1 &1390249329 stripped
GameObject:
m_PrefabParentObject: {fileID: 100008, guid: ce816f2e6abb0504092c23ed9b970dfd, type: 2}
m_PrefabInternal: {fileID: 1390249324}
--- !u!114 &1390249330
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1390249329}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 043fbfd0ae7027742bace7a3691feb13, type: 3}
m_Name:
m_EditorClassIdentifier:
localAvatarPrefab: {fileID: 11437430, guid: 84c8b8609f9bb434eaf5248f17ff1293, type: 2}
remoteAvatarPrefab: {fileID: 11464902, guid: 90bf33f968e6bb44ea0208fc82c90a44, type: 2}
helpPanel: {fileID: 840719025}
riftMaterial: {fileID: 2100000, guid: 3480b18dc3be4c2498fb60a71184a4d1, type: 2}
gearMaterial: {fileID: 2100000, guid: ce189bc65dde82740a5f34ef75bf87aa, type: 2}
roomSphere: {fileID: 1902705651}
roomFloor: {fileID: 2115777246}
spyCamera: {fileID: 206856063}
--- !u!1 &1902705651
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1902705655}
- component: {fileID: 1902705654}
- component: {fileID: 1902705653}
- component: {fileID: 1902705652}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &1902705652
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1902705651}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 296de5be1228bf34380061dd6e6b0f49, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!135 &1902705653
SphereCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1902705651}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &1902705654
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1902705651}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1902705655
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1902705651}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3, y: 6, z: 3}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2115777246
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2115777250}
- component: {fileID: 2115777249}
- component: {fileID: 2115777248}
- component: {fileID: 2115777247}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &2115777247
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2115777246}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: c466b89bb972b8a42bd266c102f8f2cb, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!64 &2115777248
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2115777246}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_SkinWidth: 0.01
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &2115777249
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2115777246}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &2115777250
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2115777246}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 7, y: 1, z: 7}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 236a5f96528802e47a70d6e47ebd3c16
timeCreated: 1496779803
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 777b874d432a52044991fe1a0210200c
folderAsset: yes
timeCreated: 1496779985
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,127 @@
%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: GearHelp
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
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: 2800000, guid: 0453138effcc80349b11371805f72f5b, type: 3}
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}
m_Floats:
- first:
name: _BumpScale
second: 1
- first:
name: _Cutoff
second: 0.5
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DstBlend
second: 0
- first:
name: _GlossMapScale
second: 1
- first:
name: _Glossiness
second: 0.5
- first:
name: _GlossyReflections
second: 1
- first:
name: _Metallic
second: 0
- first:
name: _Mode
second: 0
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _SmoothnessTextureChannel
second: 0
- first:
name: _SpecularHighlights
second: 1
- first:
name: _SrcBlend
second: 1
- first:
name: _UVSec
second: 0
- first:
name: _ZWrite
second: 1
m_Colors:
- first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 09c03a3c5049d234590b91bbc6e84462
timeCreated: 1497549036
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,127 @@
%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: Help
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
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: 2800000, guid: c8f5462cc092d0c40ad71773132863e0, type: 3}
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}
m_Floats:
- first:
name: _BumpScale
second: 1
- first:
name: _Cutoff
second: 0.5
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DstBlend
second: 0
- first:
name: _GlossMapScale
second: 1
- first:
name: _Glossiness
second: 0.5
- first:
name: _GlossyReflections
second: 1
- first:
name: _Metallic
second: 0
- first:
name: _Mode
second: 0
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _SmoothnessTextureChannel
second: 0
- first:
name: _SpecularHighlights
second: 1
- first:
name: _SrcBlend
second: 1
- first:
name: _UVSec
second: 0
- first:
name: _ZWrite
second: 1
m_Colors:
- first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4c18da23435024b43a2b78449cbb6ed0
timeCreated: 1496780065
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,127 @@
%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: Offline_Mat
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}
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}
m_Floats:
- first:
name: _BumpScale
second: 1
- first:
name: _Cutoff
second: 0.5
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DstBlend
second: 0
- first:
name: _GlossMapScale
second: 1
- first:
name: _Glossiness
second: 0.5
- first:
name: _GlossyReflections
second: 1
- first:
name: _Metallic
second: 0
- first:
name: _Mode
second: 0
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _SmoothnessTextureChannel
second: 0
- first:
name: _SpecularHighlights
second: 1
- first:
name: _SrcBlend
second: 1
- first:
name: _UVSec
second: 0
- first:
name: _ZWrite
second: 1
m_Colors:
- first:
name: _Color
second: {r: 0, g: 0, b: 0, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 296de5be1228bf34380061dd6e6b0f49
timeCreated: 1496780100
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,127 @@
%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: Plane_Mat
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}
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}
m_Floats:
- first:
name: _BumpScale
second: 1
- first:
name: _Cutoff
second: 0.5
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DstBlend
second: 0
- first:
name: _GlossMapScale
second: 1
- first:
name: _Glossiness
second: 0.5
- first:
name: _GlossyReflections
second: 1
- first:
name: _Metallic
second: 0
- first:
name: _Mode
second: 0
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _SmoothnessTextureChannel
second: 0
- first:
name: _SpecularHighlights
second: 1
- first:
name: _SrcBlend
second: 1
- first:
name: _UVSec
second: 0
- first:
name: _ZWrite
second: 1
m_Colors:
- first:
name: _Color
second: {r: 0, g: 0.25517225, b: 1, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c466b89bb972b8a42bd266c102f8f2cb
timeCreated: 1496780131
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f05e47c366870a44ab2b3b5a8a64e107
folderAsset: yes
timeCreated: 1496780004
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,231 @@
using UnityEngine;
using System;
using Oculus.Platform;
using Oculus.Platform.Models;
// Helper class to manage a Peer-to-Peer connection to the other user.
// The connection is used to send and received the Transforms for the
// Avatars. The Transforms are sent via unreliable UDP at a fixed
// frequency.
public class P2PManager
{
// packet header is a message type byte
private enum MessageType : byte
{
Update = 1,
};
public P2PManager()
{
Net.SetPeerConnectRequestCallback(PeerConnectRequestCallback);
Net.SetConnectionStateChangedCallback(ConnectionStateChangedCallback);
}
#region Connection Management
public void ConnectTo(ulong userID)
{
// ID comparison is used to decide who calls Connect and who calls Accept
if (SocialPlatformManager.MyID < userID)
{
Net.Connect(userID);
SocialPlatformManager.LogOutput("P2P connect to " + userID);
}
}
public void Disconnect(ulong userID)
{
if (userID != 0)
{
Net.Close(userID);
RemotePlayer remote = SocialPlatformManager.GetRemoteUser(userID);
if (remote != null)
{
remote.p2pConnectionState = PeerConnectionState.Unknown;
}
}
}
void PeerConnectRequestCallback(Message<NetworkingPeer> msg)
{
SocialPlatformManager.LogOutput("P2P request from " + msg.Data.ID);
RemotePlayer remote = SocialPlatformManager.GetRemoteUser(msg.Data.ID);
if (remote != null)
{
SocialPlatformManager.LogOutput("P2P request accepted from " + msg.Data.ID);
Net.Accept(msg.Data.ID);
}
}
void ConnectionStateChangedCallback(Message<NetworkingPeer> msg)
{
SocialPlatformManager.LogOutput("P2P state to " + msg.Data.ID + " changed to " + msg.Data.State);
RemotePlayer remote = SocialPlatformManager.GetRemoteUser(msg.Data.ID);
if (remote != null)
{
remote.p2pConnectionState = msg.Data.State;
if (msg.Data.State == PeerConnectionState.Timeout &&
// ID comparison is used to decide who calls Connect and who calls Accept
SocialPlatformManager.MyID < msg.Data.ID)
{
// keep trying until hangup!
Net.Connect(msg.Data.ID);
SocialPlatformManager.LogOutput("P2P re-connect to " + msg.Data.ID);
}
}
}
#endregion
#region Message Sending
public void SendAvatarUpdate(ulong userID, Transform bodyTransform, UInt32 sequence, byte[] avatarPacket)
{
const int UPDATE_DATA_LENGTH = 41;
byte[] sendBuffer = new byte[avatarPacket.Length + UPDATE_DATA_LENGTH];
int offset = 0;
PackByte((byte)MessageType.Update, sendBuffer, ref offset);
PackULong(SocialPlatformManager.MyID, sendBuffer, ref offset);
PackFloat(bodyTransform.localPosition.x, sendBuffer, ref offset);
PackFloat(bodyTransform.localPosition.y, sendBuffer, ref offset);
PackFloat(bodyTransform.localPosition.z, sendBuffer, ref offset);
PackFloat(bodyTransform.localRotation.x, sendBuffer, ref offset);
PackFloat(bodyTransform.localRotation.y, sendBuffer, ref offset);
PackFloat(bodyTransform.localRotation.z, sendBuffer, ref offset);
PackFloat(bodyTransform.localRotation.w, sendBuffer, ref offset);
PackUInt32(sequence, sendBuffer, ref offset);
Debug.Assert(offset == UPDATE_DATA_LENGTH);
Buffer.BlockCopy(avatarPacket, 0, sendBuffer, offset, avatarPacket.Length);
Net.SendPacket(userID, sendBuffer, SendPolicy.Unreliable);
}
#endregion
#region Message Receiving
public void GetRemotePackets()
{
Packet packet;
while ((packet = Net.ReadPacket()) != null)
{
byte[] receiveBuffer = new byte[packet.Size];
packet.ReadBytes(receiveBuffer);
int offset = 0;
MessageType messageType = (MessageType)ReadByte(receiveBuffer, ref offset);
ulong remoteUserID = ReadULong(receiveBuffer, ref offset);
RemotePlayer remote = SocialPlatformManager.GetRemoteUser(remoteUserID);
if (remote == null)
{
SocialPlatformManager.LogOutput("Unknown remote player: " + remoteUserID);
continue;
}
if (messageType == MessageType.Update)
{
processAvatarPacket(remote, ref receiveBuffer, ref offset);
}
else
{
SocialPlatformManager.LogOutput("Invalid packet type: " + packet.Size);
continue;
}
}
}
public void processAvatarPacket(RemotePlayer remote, ref byte[] packet, ref int offset)
{
if (remote == null)
return;
remote.receivedBodyPositionPrior = remote.receivedBodyPosition;
remote.receivedBodyPosition.x = ReadFloat(packet, ref offset);
remote.receivedBodyPosition.y = ReadFloat(packet, ref offset);
remote.receivedBodyPosition.z = ReadFloat(packet, ref offset);
remote.receivedBodyRotationPrior = remote.receivedBodyRotation;
remote.receivedBodyRotation.x = ReadFloat(packet, ref offset);
remote.receivedBodyRotation.y = ReadFloat(packet, ref offset);
remote.receivedBodyRotation.z = ReadFloat(packet, ref offset);
remote.receivedBodyRotation.w = ReadFloat(packet, ref offset);
remote.RemoteAvatar.transform.localPosition = remote.receivedBodyPosition;
remote.RemoteAvatar.transform.localRotation = remote.receivedBodyRotation;
// forward the remaining data to the avatar system
int sequence = (int)ReadUInt32(packet, ref offset);
byte[] remainingAvatarBuffer = new byte[packet.Length - offset];
Buffer.BlockCopy(packet, offset, remainingAvatarBuffer, 0, remainingAvatarBuffer.Length);
IntPtr avatarPacket = Oculus.Avatar.CAPI.ovrAvatarPacket_Read((UInt32)remainingAvatarBuffer.Length, remainingAvatarBuffer);
var ovravatarPacket = new OvrAvatarPacket { ovrNativePacket = avatarPacket };
remote.RemoteAvatar.GetComponent<OvrAvatarRemoteDriver>().QueuePacket(sequence, ovravatarPacket);
}
#endregion
#region Serialization
void PackByte(byte b, byte[] buf, ref int offset)
{
buf[offset] = b;
offset += sizeof(byte);
}
byte ReadByte(byte[] buf, ref int offset)
{
byte val = buf[offset];
offset += sizeof(byte);
return val;
}
void PackFloat(float f, byte[] buf, ref int offset)
{
Buffer.BlockCopy(BitConverter.GetBytes(f), 0, buf, offset, sizeof(float));
offset += sizeof(float);
}
float ReadFloat(byte[] buf, ref int offset)
{
float val = BitConverter.ToSingle(buf, offset);
offset += sizeof(float);
return val;
}
void PackULong(ulong u, byte[] buf, ref int offset)
{
Buffer.BlockCopy(BitConverter.GetBytes(u), 0, buf, offset, sizeof(ulong));
offset += sizeof(ulong);
}
ulong ReadULong(byte[] buf, ref int offset)
{
ulong val = BitConverter.ToUInt64(buf, offset);
offset += sizeof(ulong);
return val;
}
void PackUInt32(UInt32 u, byte[] buf, ref int offset)
{
Buffer.BlockCopy(BitConverter.GetBytes(u), 0, buf, offset, sizeof(UInt32));
offset += sizeof(UInt32);
}
UInt32 ReadUInt32(byte[] buf, ref int offset)
{
UInt32 val = BitConverter.ToUInt32(buf, offset);
offset += sizeof(UInt32);
return val;
}
#endregion
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: e5d77a60e86b5bd4a999ef6c83f9e651
timeCreated: 1521151723
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,101 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;
public class PlayerController : SocialPlatformManager
{
// Secondary camera to debug and view the whole scene from above
public Camera spyCamera;
// The OVRCameraRig for the main player so we can disable it
private GameObject cameraRig;
private bool showUI = true;
public override void Awake()
{
base.Awake();
cameraRig = localPlayerHead.gameObject;
}
// Use this for initialization
public override void Start()
{
base.Start();
spyCamera.enabled = false;
}
// Update is called once per frame
public override void Update()
{
base.Update();
checkInput();
}
// Check for input from the touch controllers
void checkInput()
{
if (UnityEngine.Application.platform == RuntimePlatform.Android)
{
// GearVR Controller
// Bring up friend invite list
if (OVRInput.GetDown(OVRInput.Button.Back))
{
Rooms.LaunchInvitableUserFlow(roomManager.roomID);
}
// Toggle Camera
if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad))
{
ToggleCamera();
}
// Toggle Help UI
if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
{
ToggleUI();
}
}
else
{
// PC Touch
// Bring up friend invite list
if (OVRInput.GetDown(OVRInput.Button.Three))
{
Rooms.LaunchInvitableUserFlow (roomManager.roomID);
}
// Toggle Camera
if (OVRInput.GetDown(OVRInput.Button.Four))
{
ToggleCamera();
}
// Toggle Help UI
if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstick))
{
ToggleUI();
}
}
}
void ToggleCamera()
{
spyCamera.enabled = !spyCamera.enabled;
localAvatar.ShowThirdPerson = !localAvatar.ShowThirdPerson;
cameraRig.SetActive(!cameraRig.activeSelf);
}
void ToggleUI()
{
showUI = !showUI;
helpPanel.SetActive(showUI);
localAvatar.ShowLeftController(showUI);
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 043fbfd0ae7027742bace7a3691feb13
timeCreated: 1521151723
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Oculus.Platform;
public class RemotePlayer
{
public ulong remoteUserID;
public bool stillInRoom;
// the result of the last connection state update message
public PeerConnectionState p2pConnectionState;
// the last reported state of the VOIP connection
public PeerConnectionState voipConnectionState;
public OvrAvatar RemoteAvatar;
// the last received position updates
public Vector3 receivedBodyPosition;
// the previous received positions to interpolate from
public Vector3 receivedBodyPositionPrior;
// the last received rotation updates
public Quaternion receivedBodyRotation;
// the previous received rotations to interpolate from
public Quaternion receivedBodyRotationPrior;
// the voip tracker for the player
public VoipAudioSourceHiLevel voipSource;
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: e5bc955e8176ef1478360f25ef5ccc8a
timeCreated: 1521151723
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,225 @@
using UnityEngine;
using System;
using System.Collections.Generic;
using Oculus.Platform;
using Oculus.Platform.Models;
// Helper class to manage Room creation, membership and invites.
// Rooms are a mechanism to help Oculus users create a shared experience.
// Users can only be in one Room at a time. If the Owner of a room
// leaves, then ownership is transferred to some other member.
// Here we use rooms to create the notion of a 'call' to help us
// invite a Friend and establish a VOIP and P2P connection.
public class RoomManager
{
// the ID of the Room that I'm in
public ulong roomID;
// the ID of the Room that I'm invited to
private ulong invitedRoomID;
// Am I the server?
private bool amIServer;
// Have we already gone through the startup?
private bool startupDone;
public RoomManager()
{
amIServer = false;
startupDone = false;
Rooms.SetRoomInviteAcceptedNotificationCallback(AcceptingInviteCallback);
Rooms.SetUpdateNotificationCallback(RoomUpdateCallback);
}
#region Launched Application from Accepting Invite
// Callback to check whether the User accepted an invite
void AcceptingInviteCallback(Message<string> msg)
{
if (msg.IsError)
{
SocialPlatformManager.TerminateWithError(msg);
return;
}
SocialPlatformManager.LogOutput("Launched Invite to join Room: " + msg.Data);
invitedRoomID = Convert.ToUInt64(msg.GetString());
if (startupDone)
{
CheckForInvite();
}
}
// Check to see if the App was launched by accepting the Notication from the main Oculus app.
// If so, we can directly join that room. (If it's still available.)
public bool CheckForInvite()
{
startupDone = true;
if (invitedRoomID != 0)
{
JoinExistingRoom(invitedRoomID);
return true;
}
else
{
return false;
}
}
#endregion
#region Create a Room and Invite Friend(s) from the Oculus Universal Menu
public void CreateRoom()
{
Rooms.CreateAndJoinPrivate(RoomJoinPolicy.FriendsOfOwner, 4, true)
.OnComplete(CreateAndJoinPrivateRoomCallback);
}
void CreateAndJoinPrivateRoomCallback(Message<Oculus.Platform.Models.Room> msg)
{
if (msg.IsError)
{
SocialPlatformManager.TerminateWithError(msg);
return;
}
roomID = msg.Data.ID;
if (msg.Data.OwnerOptional != null && msg.Data.OwnerOptional.ID == SocialPlatformManager.MyID)
{
amIServer = true;
}
else
{
amIServer = false;
}
SocialPlatformManager.TransitionToState(SocialPlatformManager.State.WAITING_IN_A_ROOM);
SocialPlatformManager.SetFloorColorForState(amIServer);
}
void OnLaunchInviteWorkflowComplete(Message msg)
{
if (msg.IsError)
{
SocialPlatformManager.TerminateWithError(msg);
return;
}
}
#endregion
#region Accept Invite
public void JoinExistingRoom(ulong roomID)
{
SocialPlatformManager.TransitionToState(SocialPlatformManager.State.JOINING_A_ROOM);
Rooms.Join(roomID, true).OnComplete(JoinRoomCallback);
}
void JoinRoomCallback(Message<Oculus.Platform.Models.Room> msg)
{
if (msg.IsError)
{
// is reasonable if caller called more than 1 person, and I didn't answer first
return;
}
var ownerOculusId = msg.Data.OwnerOptional != null ? msg.Data.OwnerOptional.OculusID : "null";
var userCount = msg.Data.UsersOptional != null ? msg.Data.UsersOptional.Count : 0;
SocialPlatformManager.LogOutput("Joined Room " + msg.Data.ID + " owner: " + ownerOculusId + " count: " + userCount);
roomID = msg.Data.ID;
ProcessRoomData(msg);
}
#endregion
#region Room Updates
void RoomUpdateCallback(Message<Oculus.Platform.Models.Room> msg)
{
if (msg.IsError)
{
SocialPlatformManager.TerminateWithError(msg);
return;
}
var ownerOculusId = msg.Data.OwnerOptional != null ? msg.Data.OwnerOptional.OculusID : "null";
var userCount = msg.Data.UsersOptional != null ? msg.Data.UsersOptional.Count : 0;
SocialPlatformManager.LogOutput("Room Update " + msg.Data.ID + " owner: " + ownerOculusId + " count: " + userCount);
ProcessRoomData(msg);
}
#endregion
#region Room Exit
public void LeaveCurrentRoom()
{
if (roomID != 0)
{
Rooms.Leave(roomID);
roomID = 0;
}
SocialPlatformManager.TransitionToState(SocialPlatformManager.State.LEAVING_A_ROOM);
}
#endregion
#region Process Room Data
void ProcessRoomData(Message<Oculus.Platform.Models.Room> msg)
{
if (msg.Data.OwnerOptional != null && msg.Data.OwnerOptional.ID == SocialPlatformManager.MyID)
{
amIServer = true;
}
else
{
amIServer = false;
}
// if the caller left while I was in the process of joining, just use that as our new room
if (msg.Data.UsersOptional != null && msg.Data.UsersOptional.Count == 1)
{
SocialPlatformManager.TransitionToState(SocialPlatformManager.State.WAITING_IN_A_ROOM);
}
else
{
SocialPlatformManager.TransitionToState(SocialPlatformManager.State.CONNECTED_IN_A_ROOM);
}
// Look for users that left
SocialPlatformManager.MarkAllRemoteUsersAsNotInRoom();
if (msg.Data.UsersOptional != null)
{
foreach (User user in msg.Data.UsersOptional)
{
if (user.ID != SocialPlatformManager.MyID)
{
if (!SocialPlatformManager.IsUserInRoom(user.ID))
{
SocialPlatformManager.AddRemoteUser(user.ID);
}
else
{
SocialPlatformManager.MarkRemoteUserInRoom(user.ID);
}
}
}
}
SocialPlatformManager.ForgetRemoteUsersNotInRoom();
SocialPlatformManager.SetFloorColorForState(amIServer);
}
#endregion
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 923f57b3cf1990047b2e448680c8d5b8
timeCreated: 1521151723
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,556 @@
using UnityEngine;
using System;
using System.IO;
using System.Collections.Generic;
using Oculus.Avatar;
using Oculus.Platform;
using Oculus.Platform.Models;
// This class coordinates communication with the Oculus Platform
// Service running in your device.
public class SocialPlatformManager : MonoBehaviour
{
private static readonly Vector3 START_ROTATION_ONE = new Vector3(0, 180, 0);
private static readonly Vector3 START_POSITION_ONE = new Vector3(0, 4, 5);
private static readonly Vector3 START_ROTATION_TWO = new Vector3(0, 0, 0);
private static readonly Vector3 START_POSITION_TWO = new Vector3(0, 4, -5);
private static readonly Vector3 START_ROTATION_THREE = new Vector3(0, 270, 0);
private static readonly Vector3 START_POSITION_THREE = new Vector3(5, 4, 0);
private static readonly Vector3 START_ROTATION_FOUR = new Vector3(0, 90, 0);
private static readonly Vector3 START_POSITION_FOUR = new Vector3(-5, 4, 0);
private static readonly Color BLACK = new Color(0.0f, 0.0f, 0.0f);
private static readonly Color WHITE = new Color(1.0f, 1.0f, 1.0f);
private static readonly Color CYAN = new Color(0.0f, 1.0f, 1.0f);
private static readonly Color BLUE = new Color(0.0f, 0.0f, 1.0f);
private static readonly Color GREEN = new Color(0.0f, 1.0f, 0.0f);
public Oculus.Platform.CAPI.FilterCallback micFilterDelegate = new Oculus.Platform.CAPI.FilterCallback(SocialPlatformManager.MicFilter);
private float voiceCurrent = 0.0f;
// Local player
private UInt32 packetSequence = 0;
public OvrAvatar localAvatarPrefab;
public OvrAvatar remoteAvatarPrefab;
public GameObject helpPanel;
protected MeshRenderer helpMesh;
public Material riftMaterial;
public Material gearMaterial;
protected OvrAvatar localAvatar;
protected GameObject localTrackingSpace;
protected GameObject localPlayerHead;
// Remote players
protected Dictionary<ulong, RemotePlayer> remoteUsers = new Dictionary<ulong, RemotePlayer>();
// GameObject that represents the center sphere as a visual status indicator of the room
public GameObject roomSphere;
protected MeshRenderer sphereMesh;
public GameObject roomFloor;
protected MeshRenderer floorMesh;
protected State currentState;
protected static SocialPlatformManager s_instance = null;
protected RoomManager roomManager;
protected P2PManager p2pManager;
protected VoipManager voipManager;
// my Application-scoped Oculus ID
protected ulong myID;
// my Oculus user name
protected string myOculusID;
// animating the mouth for voip
public static readonly float VOIP_SCALE = 2f;
public virtual void Update()
{
// Look for updates from remote users
p2pManager.GetRemotePackets();
// update avatar mouths to match voip volume
foreach (KeyValuePair<ulong, RemotePlayer> kvp in remoteUsers)
{
float remoteVoiceCurrent = Mathf.Clamp(kvp.Value.voipSource.peakAmplitude * VOIP_SCALE, 0f, 1f);
kvp.Value.RemoteAvatar.VoiceAmplitude = remoteVoiceCurrent;
}
if (localAvatar != null)
{
localAvatar.VoiceAmplitude = Mathf.Clamp(voiceCurrent * VOIP_SCALE, 0f, 1f);
}
}
#region Initialization and Shutdown
public virtual void Awake()
{
LogOutputLine("Start Log.");
// Grab the MeshRenderers. We'll be using the material colour to visually show status
helpMesh = helpPanel.GetComponent<MeshRenderer>();
sphereMesh = roomSphere.GetComponent<MeshRenderer>();
floorMesh = roomFloor.GetComponent<MeshRenderer>();
// Set up the local player
localTrackingSpace = this.transform.Find("OVRCameraRig/TrackingSpace").gameObject;
localPlayerHead = this.transform.Find("OVRCameraRig/TrackingSpace/CenterEyeAnchor").gameObject;
// make sure only one instance of this manager ever exists
if (s_instance != null)
{
Destroy(gameObject);
return;
}
s_instance = this;
DontDestroyOnLoad(gameObject);
TransitionToState(State.INITIALIZING);
Core.Initialize();
roomManager = new RoomManager();
p2pManager = new P2PManager();
voipManager = new VoipManager();
}
public virtual void Start()
{
// First thing we should do is perform an entitlement check to make sure
// we successfully connected to the Oculus Platform Service.
Entitlements.IsUserEntitledToApplication().OnComplete(IsEntitledCallback);
Oculus.Platform.Request.RunCallbacks();
}
void IsEntitledCallback(Message msg)
{
if (msg.IsError)
{
TerminateWithError(msg);
return;
}
// Next get the identity of the user that launched the Application.
Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}
void GetLoggedInUserCallback(Message<User> msg)
{
if (msg.IsError)
{
TerminateWithError(msg);
return;
}
myID = msg.Data.ID;
myOculusID = msg.Data.OculusID;
localAvatar = Instantiate(localAvatarPrefab);
localTrackingSpace = this.transform.Find("OVRCameraRig/TrackingSpace").gameObject;
localAvatar.transform.SetParent(localTrackingSpace.transform, false);
localAvatar.transform.localPosition = new Vector3(0, 0, 0);
localAvatar.transform.localRotation = Quaternion.identity;
if (UnityEngine.Application.platform == RuntimePlatform.Android)
{
helpPanel.transform.SetParent(localAvatar.transform.Find("body"), false);
helpPanel.transform.localPosition = new Vector3(0, 1.0f, 1.0f);
helpMesh.material = gearMaterial;
}
else
{
helpPanel.transform.SetParent(localAvatar.transform.Find("hand_left"), false);
helpPanel.transform.localPosition = new Vector3(0, 0.2f, 0.2f);
helpMesh.material = riftMaterial;
}
localAvatar.oculusUserID = myID.ToString();
localAvatar.RecordPackets = true;
localAvatar.PacketRecorded += OnLocalAvatarPacketRecorded;
localAvatar.EnableMouthVertexAnimation = true;
Quaternion rotation = Quaternion.identity;
switch (UnityEngine.Random.Range(0, 4))
{
case 0:
rotation.eulerAngles = START_ROTATION_ONE;
this.transform.localPosition = START_POSITION_ONE;
this.transform.localRotation = rotation;
break;
case 1:
rotation.eulerAngles = START_ROTATION_TWO;
this.transform.localPosition = START_POSITION_TWO;
this.transform.localRotation = rotation;
break;
case 2:
rotation.eulerAngles = START_ROTATION_THREE;
this.transform.localPosition = START_POSITION_THREE;
this.transform.localRotation = rotation;
break;
case 3:
default:
rotation.eulerAngles = START_ROTATION_FOUR;
this.transform.localPosition = START_POSITION_FOUR;
this.transform.localRotation = rotation;
break;
}
TransitionToState(State.CHECKING_LAUNCH_STATE);
// If the user launched the app by accepting the notification, then we want to
// join that room. If not, try to find a friend's room to join
if (!roomManager.CheckForInvite())
{
SocialPlatformManager.LogOutput("No invite on launch, looking for a friend to join.");
Users.GetLoggedInUserFriendsAndRooms()
.OnComplete(GetLoggedInUserFriendsAndRoomsCallback);
}
Voip.SetMicrophoneFilterCallback(micFilterDelegate);
}
void GetLoggedInUserFriendsAndRoomsCallback(Message<UserAndRoomList> msg)
{
if (msg.IsError)
{
return;
}
foreach (UserAndRoom el in msg.Data)
{
// see if any friends are in a joinable room
if (el.User == null) continue;
if (el.RoomOptional == null) continue;
if (el.RoomOptional.IsMembershipLocked == true) continue;
if (el.RoomOptional.Joinability != RoomJoinability.CanJoin) continue;
if (el.RoomOptional.JoinPolicy == RoomJoinPolicy.None) continue;
SocialPlatformManager.LogOutput("Trying to join room " + el.RoomOptional.ID + ", friend " + el.User.OculusID);
roomManager.JoinExistingRoom(el.RoomOptional.ID);
return;
}
SocialPlatformManager.LogOutput("No friend to join. Creating my own room.");
// didn't find any open rooms, start a new room
roomManager.CreateRoom();
TransitionToState(State.CREATING_A_ROOM);
}
public void OnLocalAvatarPacketRecorded(object sender, OvrAvatar.PacketEventArgs args)
{
var size = Oculus.Avatar.CAPI.ovrAvatarPacket_GetSize(args.Packet.ovrNativePacket);
byte[] toSend = new byte[size];
Oculus.Avatar.CAPI.ovrAvatarPacket_Write(args.Packet.ovrNativePacket, size, toSend);
foreach (KeyValuePair<ulong, RemotePlayer> kvp in remoteUsers)
{
//LogOutputLine("Sending avatar Packet to " + kvp.Key);
p2pManager.SendAvatarUpdate(kvp.Key, this.localAvatar.transform, packetSequence, toSend);
}
packetSequence++;
}
public void OnApplicationQuit()
{
roomManager.LeaveCurrentRoom();
foreach (KeyValuePair<ulong, RemotePlayer> kvp in remoteUsers)
{
p2pManager.Disconnect(kvp.Key);
voipManager.Disconnect(kvp.Key);
}
LogOutputLine("End Log.");
}
public void AddUser(ulong userID, ref RemotePlayer remoteUser)
{
remoteUsers.Add(userID, remoteUser);
}
public void LogOutputLine(string line)
{
Debug.Log(Time.time + ": " + line);
}
// For most errors we terminate the Application since this example doesn't make
// sense if the user is disconnected.
public static void TerminateWithError(Message msg)
{
s_instance.LogOutputLine("Error: " + msg.GetError().Message);
UnityEngine.Application.Quit();
}
#endregion
#region Properties
public static State CurrentState
{
get
{
return s_instance.currentState;
}
}
public static ulong MyID
{
get
{
if (s_instance != null)
{
return s_instance.myID;
}
else
{
return 0;
}
}
}
public static string MyOculusID
{
get
{
if (s_instance != null && s_instance.myOculusID != null)
{
return s_instance.myOculusID;
}
else
{
return string.Empty;
}
}
}
#endregion
#region State Management
public enum State
{
// loading platform library, checking application entitlement,
// getting the local user info
INITIALIZING,
// Checking to see if we were launched from an invite
CHECKING_LAUNCH_STATE,
// Creating a room to join
CREATING_A_ROOM,
// in this state we've create a room, and hopefully
// sent some invites, and we're waiting people to join
WAITING_IN_A_ROOM,
// in this state we're attempting to join a room from an invite
JOINING_A_ROOM,
// we're in a room with others
CONNECTED_IN_A_ROOM,
// Leaving a room
LEAVING_A_ROOM,
// shutdown any connections and leave the current room
SHUTDOWN,
};
public static void TransitionToState(State newState)
{
if (s_instance)
{
s_instance.LogOutputLine("State " + s_instance.currentState + " -> " + newState);
}
if (s_instance && s_instance.currentState != newState)
{
s_instance.currentState = newState;
// state transition logic
switch (newState)
{
case State.SHUTDOWN:
s_instance.OnApplicationQuit();
break;
default:
break;
}
}
SetSphereColorForState();
}
private static void SetSphereColorForState()
{
switch (s_instance.currentState)
{
case State.INITIALIZING:
case State.SHUTDOWN:
s_instance.sphereMesh.material.color = BLACK;
break;
case State.WAITING_IN_A_ROOM:
s_instance.sphereMesh.material.color = WHITE;
break;
case State.CONNECTED_IN_A_ROOM:
s_instance.sphereMesh.material.color = CYAN;
break;
default:
break;
}
}
public static void SetFloorColorForState(bool host)
{
if (host)
{
s_instance.floorMesh.material.color = BLUE;
}
else
{
s_instance.floorMesh.material.color = GREEN;
}
}
public static void MarkAllRemoteUsersAsNotInRoom()
{
foreach (KeyValuePair<ulong, RemotePlayer> kvp in s_instance.remoteUsers)
{
kvp.Value.stillInRoom = false;
}
}
public static void MarkRemoteUserInRoom(ulong userID)
{
RemotePlayer remoteUser = new RemotePlayer();
if (s_instance.remoteUsers.TryGetValue(userID, out remoteUser))
{
remoteUser.stillInRoom = true;
}
}
public static void ForgetRemoteUsersNotInRoom()
{
List<ulong> toPurge = new List<ulong>();
foreach (KeyValuePair<ulong, RemotePlayer> kvp in s_instance.remoteUsers)
{
if (kvp.Value.stillInRoom == false)
{
toPurge.Add(kvp.Key);
}
}
foreach (ulong key in toPurge)
{
RemoveRemoteUser(key);
}
}
public static void LogOutput(string line)
{
s_instance.LogOutputLine(Time.time + ": " + line);
}
public static bool IsUserInRoom(ulong userID)
{
return s_instance.remoteUsers.ContainsKey(userID);
}
public static void AddRemoteUser(ulong userID)
{
RemotePlayer remoteUser = new RemotePlayer();
remoteUser.RemoteAvatar = Instantiate(s_instance.remoteAvatarPrefab);
remoteUser.RemoteAvatar.oculusUserID = userID.ToString();
remoteUser.RemoteAvatar.ShowThirdPerson = true;
remoteUser.RemoteAvatar.EnableMouthVertexAnimation = true;
remoteUser.p2pConnectionState = PeerConnectionState.Unknown;
remoteUser.voipConnectionState = PeerConnectionState.Unknown;
remoteUser.stillInRoom = true;
remoteUser.remoteUserID = userID;
s_instance.AddUser(userID, ref remoteUser);
s_instance.p2pManager.ConnectTo(userID);
s_instance.voipManager.ConnectTo(userID);
remoteUser.voipSource = remoteUser.RemoteAvatar.gameObject.AddComponent<VoipAudioSourceHiLevel>();
remoteUser.voipSource.senderID = userID;
s_instance.LogOutputLine("Adding User " + userID);
}
public static void RemoveRemoteUser(ulong userID)
{
RemotePlayer remoteUser = new RemotePlayer();
if (s_instance.remoteUsers.TryGetValue(userID, out remoteUser))
{
Destroy(remoteUser.RemoteAvatar.GetComponent<VoipAudioSourceHiLevel>(), 0);
Destroy(remoteUser.RemoteAvatar.gameObject, 0);
s_instance.remoteUsers.Remove(userID);
s_instance.LogOutputLine("Removing User " + userID);
}
}
public void UpdateVoiceData(short[] pcmData)
{
float voiceMax = 0.0f;
float[] floats = new float[pcmData.Length];
for (int n = 0; n < pcmData.Length; n++)
{
float cur = floats[n] = (float)pcmData[n] / (float)short.MaxValue;
if (cur > voiceMax)
{
voiceMax = cur;
}
}
voiceCurrent = voiceMax;
}
public static void MicFilter(short[] pcmData, System.UIntPtr pcmDataLength, int frequency, int numChannels)
{
s_instance.UpdateVoiceData(pcmData);
}
public static RemotePlayer GetRemoteUser(ulong userID)
{
RemotePlayer remoteUser = new RemotePlayer();
if (s_instance.remoteUsers.TryGetValue(userID, out remoteUser))
{
return remoteUser;
}
else
{
return null;
}
}
#endregion
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 61a76ada1a1960647bf44fc08c5d5743
timeCreated: 1536104814
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,72 @@
using UnityEngine;
using System.Collections;
using Oculus.Platform;
using Oculus.Platform.Models;
// Helper class to manage the Voice-over-IP connection to the
// remote users
public class VoipManager
{
public VoipManager()
{
Voip.SetVoipConnectRequestCallback(VoipConnectRequestCallback);
Voip.SetVoipStateChangeCallback(VoipStateChangedCallback);
}
public void ConnectTo(ulong userID)
{
// ID comparison is used to decide who initiates and who gets the Callback
if (SocialPlatformManager.MyID < userID)
{
Voip.Start(userID);
SocialPlatformManager.LogOutput("Voip connect to " + userID);
}
}
public void Disconnect(ulong userID)
{
if (userID != 0)
{
Voip.Stop(userID);
RemotePlayer remote = SocialPlatformManager.GetRemoteUser(userID);
if (remote != null)
{
remote.voipConnectionState = PeerConnectionState.Unknown;
}
}
}
void VoipConnectRequestCallback(Message<NetworkingPeer> msg)
{
SocialPlatformManager.LogOutput("Voip request from " + msg.Data.ID);
RemotePlayer remote = SocialPlatformManager.GetRemoteUser(msg.Data.ID);
if (remote != null)
{
SocialPlatformManager.LogOutput("Voip request accepted from " + msg.Data.ID);
Voip.Accept(msg.Data.ID);
}
}
void VoipStateChangedCallback(Message<NetworkingPeer> msg)
{
SocialPlatformManager.LogOutput("Voip state to " + msg.Data.ID + " changed to " + msg.Data.State);
RemotePlayer remote = SocialPlatformManager.GetRemoteUser(msg.Data.ID);
if (remote != null)
{
remote.voipConnectionState = msg.Data.State;
// ID comparison is used to decide who initiates and who gets the Callback
if (msg.Data.State == PeerConnectionState.Timeout && SocialPlatformManager.MyID < msg.Data.ID)
{
// keep trying until hangup!
Voip.Start(msg.Data.ID);
SocialPlatformManager.LogOutput("Voip re-connect to " + msg.Data.ID);
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: d22b9da5532b0224f82207825f9f6a65
timeCreated: 1521151723
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fc164fe2aad000b40a6f426b477793aa
folderAsset: yes
timeCreated: 1496779994
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,58 @@
fileFormatVersion: 2
guid: 0453138effcc80349b11371805f72f5b
timeCreated: 1497548991
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
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: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
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: 0
spriteTessellationDetail: -1
textureType: -1
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,58 @@
fileFormatVersion: 2
guid: c8f5462cc092d0c40ad71773132863e0
timeCreated: 1496780052
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
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: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
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: 0
spriteTessellationDetail: -1
textureType: -1
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant: