update CCK to 3.10, fixing unity 2021 crash :)

This commit is contained in:
Crispy 2024-08-03 22:24:42 +02:00
parent 48a978fa2a
commit d11e0fb3a9
492 changed files with 2165204 additions and 437687 deletions

View file

@ -30,7 +30,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 0 m_CanTransitionToSelf: 0
--- !u!1102 &-8575928686238360318 --- !u!1102 &-8575928686238360318
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -120,7 +120,7 @@ AnimatorTransition:
serializedVersion: 1 serializedVersion: 1
--- !u!1107 &-7905436042452569650 --- !u!1107 &-7905436042452569650
AnimatorStateMachine: AnimatorStateMachine:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -187,6 +187,19 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!114 &-7535938694678565488
MonoBehaviour:
m_ObjectHideFlags: 1
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: 1f35791917ec48529cb942ba2598bbd0, type: 3}
m_Name:
m_EditorClassIdentifier:
localOnly: 1
--- !u!1101 &-7383988135307241380 --- !u!1101 &-7383988135307241380
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -376,7 +389,7 @@ BlendTree:
m_BlendType: 0 m_BlendType: 0
--- !u!1102 &-5848515141677793121 --- !u!1102 &-5848515141677793121
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -418,7 +431,7 @@ AnimatorTransition:
serializedVersion: 1 serializedVersion: 1
--- !u!1102 &-5762917097003648310 --- !u!1102 &-5762917097003648310
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -520,7 +533,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &-5212312055549061658 --- !u!1102 &-5212312055549061658
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -574,7 +587,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 0 m_CanTransitionToSelf: 0
--- !u!1102 &-4176217532650029860 --- !u!1102 &-4176217532650029860
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -626,7 +639,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &-3776061064005231071 --- !u!1102 &-3776061064005231071
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -855,7 +868,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &-2971020236880558411 --- !u!1102 &-2971020236880558411
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -906,7 +919,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 0 m_CanTransitionToSelf: 0
--- !u!1102 &-2744220122251862720 --- !u!1102 &-2744220122251862720
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -932,7 +945,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &-2555942240256739116 --- !u!1102 &-2555942240256739116
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1054,7 +1067,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 0 m_CanTransitionToSelf: 0
--- !u!1102 &-2040588628575872751 --- !u!1102 &-2040588628575872751
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1137,7 +1150,7 @@ AnimatorTransition:
serializedVersion: 1 serializedVersion: 1
--- !u!1102 &-1341855943854154521 --- !u!1102 &-1341855943854154521
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1165,7 +1178,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1107 &-1203605686602934362 --- !u!1107 &-1203605686602934362
AnimatorStateMachine: AnimatorStateMachine:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1268,7 +1281,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 0 m_CanTransitionToSelf: 0
--- !u!1102 &-156729428921104499 --- !u!1102 &-156729428921104499
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1295,7 +1308,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &-154334537757261262 --- !u!1102 &-154334537757261262
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1455,6 +1468,12 @@ AnimatorController:
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 9100000}
- m_Name: Swimming
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers: m_AnimatorLayers:
- serializedVersion: 5 - serializedVersion: 5
m_Name: Locomotion/Emotes m_Name: Locomotion/Emotes
@ -1506,8 +1525,8 @@ AnimatorController:
m_Controller: {fileID: 9100000} m_Controller: {fileID: 9100000}
--- !u!1102 &118869319419621521 --- !u!1102 &118869319419621521
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 3 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
@ -1516,11 +1535,13 @@ AnimatorState:
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: m_Transitions:
- {fileID: -5678050809346966151} - {fileID: -5678050809346966151}
- {fileID: 3572767232398706147}
- {fileID: -4066033034121896055} - {fileID: -4066033034121896055}
- {fileID: -3229292603251348601} - {fileID: -3229292603251348601}
- {fileID: 3946938254716387303} - {fileID: 3946938254716387303}
- {fileID: -3166696995532593217} - {fileID: -3166696995532593217}
m_StateMachineBehaviours: [] m_StateMachineBehaviours:
- {fileID: -7535938694678565488}
m_Position: {x: 50, y: 50, z: 0} m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0 m_IKOnFeet: 0
m_WriteDefaultValues: 1 m_WriteDefaultValues: 1
@ -1530,14 +1551,14 @@ AnimatorState:
m_CycleOffsetParameterActive: 0 m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0 m_TimeParameterActive: 0
m_Motion: {fileID: 8274211649648042503} m_Motion: {fileID: 8274211649648042503}
m_Tag: m_Tag: Meow
m_SpeedParameter: m_SpeedParameter:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &233270830039035002 --- !u!1102 &233270830039035002
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1580,7 +1601,7 @@ AnimatorTransition:
serializedVersion: 1 serializedVersion: 1
--- !u!1102 &658084820387618928 --- !u!1102 &658084820387618928
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1675,7 +1696,7 @@ AnimatorTransition:
serializedVersion: 1 serializedVersion: 1
--- !u!1102 &2304538748422170667 --- !u!1102 &2304538748422170667
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1701,7 +1722,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &2602977761055071538 --- !u!1102 &2602977761055071538
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1772,7 +1793,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 0 m_CanTransitionToSelf: 0
--- !u!1107 &2767261357366282130 --- !u!1107 &2767261357366282130
AnimatorStateMachine: AnimatorStateMachine:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1902,7 +1923,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &3276707479722396692 --- !u!1102 &3276707479722396692
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1928,6 +1949,86 @@ AnimatorState:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
m_TimeParameter: m_TimeParameter:
--- !u!206 &3459846366197424467
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 9443328bbbc27d4419103ed80d187900, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 8cffe7215c0af9844b722e669686a1a6, type: 2}
m_Threshold: 0.25
m_Position: {x: 0, y: 1}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: ef045d2be395dc44ab7528bf08f37175, type: 2}
m_Threshold: 0.5
m_Position: {x: 0, y: -1}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: e2eff4c689493704ca692934da7e2ca8, type: 2}
m_Threshold: 0.75
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: c7250af75e246de4496f44e795f27879, type: 2}
m_Threshold: 1
m_Position: {x: -1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
m_BlendParameter: MovementX
m_BlendParameterY: MovementY
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 2
--- !u!1101 &3572767232398706147
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Swimming
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5012013125621388658}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.9160632
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &3946938254716387303 --- !u!1101 &3946938254716387303
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -1955,7 +2056,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &3994638550199382609 --- !u!1102 &3994638550199382609
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -1982,7 +2083,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &4271106711531402262 --- !u!1102 &4271106711531402262
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2008,7 +2109,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &4456696623592799809 --- !u!1102 &4456696623592799809
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2076,6 +2177,33 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &5012013125621388658
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Swimming
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 6540986091921151125}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 20600000, guid: e515756f6fe01514ca3d7b4199f2550f, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &5126567008601290482 --- !u!1101 &5126567008601290482
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -2100,7 +2228,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &5223277037249214187 --- !u!1102 &5223277037249214187
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2153,7 +2281,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &5438168600987299438 --- !u!1102 &5438168600987299438
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2179,7 +2307,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &5442494540355277550 --- !u!1102 &5442494540355277550
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2309,7 +2437,7 @@ BlendTree:
m_BlendType: 0 m_BlendType: 0
--- !u!1107 &5867070248606979536 --- !u!1107 &5867070248606979536
AnimatorStateMachine: AnimatorStateMachine:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2340,6 +2468,9 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: -2040588628575872751} m_State: {fileID: -2040588628575872751}
m_Position: {x: 300, y: -100, z: 0} m_Position: {x: 300, y: -100, z: 0}
- serializedVersion: 1
m_State: {fileID: 5012013125621388658}
m_Position: {x: 600, y: 200, z: 0}
m_ChildStateMachines: m_ChildStateMachines:
- serializedVersion: 1 - serializedVersion: 1
m_StateMachine: {fileID: 2767261357366282130} m_StateMachine: {fileID: 2767261357366282130}
@ -2382,9 +2513,34 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 0 m_CanTransitionToSelf: 0
--- !u!1101 &6540986091921151125
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: Swimming
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 118869319419621521}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &6865703643883630721 --- !u!1102 &6865703643883630721
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2410,7 +2566,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &7219575405050605370 --- !u!1102 &7219575405050605370
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2436,7 +2592,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &7224059104922430493 --- !u!1102 &7224059104922430493
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2464,7 +2620,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &7237957086147707558 --- !u!1102 &7237957086147707558
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2556,7 +2712,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &8150364249973559019 --- !u!1102 &8150364249973559019
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2582,7 +2738,7 @@ AnimatorState:
m_TimeParameter: m_TimeParameter:
--- !u!206 &8274211649648042503 --- !u!206 &8274211649648042503
BlendTree: BlendTree:
m_ObjectHideFlags: 3 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
@ -2750,7 +2906,7 @@ AnimatorTransition:
serializedVersion: 1 serializedVersion: 1
--- !u!1107 &8638921101301456094 --- !u!1107 &8638921101301456094
AnimatorStateMachine: AnimatorStateMachine:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -2822,7 +2978,7 @@ AnimatorStateTransition:
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1102 &9047566740659613346 --- !u!1102 &9047566740659613346
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ac64d31da463e8c45a3637dec9d88b75
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b41e727fdda450847a7bd604e26f05ed
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1169f6eb555b9f444b752fd9f6e0c0c4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 85cb3c8a43a51034395ad0b3b72c93bd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4626925fdd949d94c8cb017a4c4b9714
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 91877201d94a38048a1a6a9d15503077
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0d1ff7954da93814bacbe18a6307a838
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8b7afbaccc6d45f408572bde752fb716
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5fda0726fe0b0fe48b9323b47a672b1b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ef045d2be395dc44ab7528bf08f37175
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8cffe7215c0af9844b722e669686a1a6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9443328bbbc27d4419103ed80d187900
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c7250af75e246de4496f44e795f27879
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e2eff4c689493704ca692934da7e2ca8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c67e70d6b74adc84c8571e63545f2857
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2ce7de4873aefd54a949c4faabfcd8a0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a9fa2a16f779be049ae0a06d493e6ce7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 344665d8c78a94d40a35e231a5459128
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: db8de2d0eda23614a84d4949c832dbe4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: efb214a0b138b444eaaf88143c430556
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5f1d7c7970b33d540bc01533807775de
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: debb7e0b92d911d41a79009885df927d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 90995ac9d7280ea4fae3bf7df5fdc146
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,73 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!206 &20600000
BlendTree:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LocSwimmingTree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 344665d8c78a94d40a35e231a5459128, type: 2}
m_Threshold: 0.049019612
m_Position: {x: 0, y: 1}
m_TimeScale: 2
m_CycleOffset: 0
m_DirectBlendParameter: MovementZ
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: efb214a0b138b444eaaf88143c430556, type: 2}
m_Threshold: 0.05294118
m_Position: {x: 0, y: 0.5}
m_TimeScale: 3
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: debb7e0b92d911d41a79009885df927d, type: 2}
m_Threshold: 0.056862753
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementZ
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 2ce7de4873aefd54a949c4faabfcd8a0, type: 2}
m_Threshold: 0.06078432
m_Position: {x: 0, y: -1}
m_TimeScale: 3
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: ef045d2be395dc44ab7528bf08f37175, type: 2}
m_Threshold: 0.06470589
m_Position: {x: 0, y: -0.5}
m_TimeScale: -1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: c7250af75e246de4496f44e795f27879, type: 2}
m_Threshold: 0.06862746
m_Position: {x: -1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: e2eff4c689493704ca692934da7e2ca8, type: 2}
m_Threshold: 0.07254903
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: MovementX
m_Mirror: 0
m_BlendParameter: MovementX
m_BlendParameterY: MovementY
m_MinThreshold: 0.049019612
m_MaxThreshold: 0.07254903
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 2

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e515756f6fe01514ca3d7b4199f2550f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 20600000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -3,11 +3,14 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class AnimatorDriver : StateMachineBehaviour [HelpURL("https://developers.abinteractive.net/cck/")]
public class AnimatorDriver : StateMachineBehaviour, ICCK_Component
{ {
public List<AnimatorDriverTask> EnterTasks = new List<AnimatorDriverTask>(); public List<AnimatorDriverTask> EnterTasks = new List<AnimatorDriverTask>();
public List<AnimatorDriverTask> ExitTasks = new List<AnimatorDriverTask>(); public List<AnimatorDriverTask> ExitTasks = new List<AnimatorDriverTask>();
public bool localOnly = false;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{ {
foreach (var task in EnterTasks) foreach (var task in EnterTasks)
@ -124,10 +127,10 @@ namespace ABI.CCK.Components
valB = bValue; valB = bValue;
break; break;
case SourceType.Random: case SourceType.Random:
valB = Random.Range(bValue, aMax); valB = Random.Range(bValue, bMax);
break; break;
case SourceType.Parameter: case SourceType.Parameter:
switch (aParamType) switch (bParamType)
{ {
default: default:
valB = 0f; valB = 0f;
@ -201,7 +204,7 @@ namespace ABI.CCK.Components
animator.SetFloat(targetName, res); animator.SetFloat(targetName, res);
break; break;
case ParameterType.Int: case ParameterType.Int:
animator.SetInteger(targetName, (int) res); animator.SetInteger(targetName, Mathf.RoundToInt(res));
break; break;
} }
} }

View file

@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace ABI.CCK.Components
{
[HelpURL("https://developers.abinteractive.net/cck/")]
public class BodyControl : StateMachineBehaviour, ICCK_Component
{
#region UnityEvents
// Events for third party components to hook into
public static readonly UnityEvent<Animator, BodyControl> OnInitialized = new();
public static readonly UnityEvent<Animator, BodyControlTask> OnExecuteEnterTask = new();
public static readonly UnityEvent<Animator, BodyControlTask> OnExecuteExitTask = new();
#endregion
public List<BodyControlTask> EnterTasks = new();
public List<BodyControlTask> ExitTasks = new();
private bool _initialized;
#region Unity Events
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (!_initialized) Initialize(animator);
foreach (BodyControlTask task in EnterTasks)
{
task.Execute(animator);
OnExecuteEnterTask.Invoke(animator, task);
}
}
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (!_initialized) Initialize(animator);
foreach (BodyControlTask task in ExitTasks)
{
task.Execute(animator);
OnExecuteExitTask.Invoke(animator, task);
}
}
#endregion
#region Private Methods
private void Initialize(Animator animator)
{
_initialized = true;
OnInitialized.Invoke(animator, this);
}
#endregion
#region Editor Methods
private void OnValidate()
{
var seenTargets = new HashSet<BodyControlTask.BodyMask>();
for (int i = EnterTasks.Count - 1; i >= 0; i--)
{
if (!seenTargets.Add(EnterTasks[i].target))
EnterTasks.RemoveAt(i);
}
seenTargets.Clear();
for (int i = ExitTasks.Count - 1; i >= 0; i--)
{
if (!seenTargets.Add(ExitTasks[i].target))
ExitTasks.RemoveAt(i);
}
seenTargets.Clear();
}
#endregion
}
[Serializable]
public class BodyControlTask
{
public enum BodyMask
{
Head,
Pelvis,
LeftArm,
RightArm,
LeftLeg,
RightLeg,
Locomotion,
// TODO: Add FingerTracking masks when GS is ready
}
public BodyMask target = BodyMask.Head;
[Range(0f, 1f)] public float targetWeight = 1f;
public float transitionDuration = 0f;
// Type
public bool isBlend = false;
public void Execute(Animator animator)
{
// switch (target)
// {
// case BodyMask.Head:
// break;
// case BodyMask.Pelvis:
// break;
// case BodyMask.LeftArm:
// break;
// case BodyMask.RightArm:
// break;
// case BodyMask.LeftLeg:
// break;
// case BodyMask.RightLeg:
// break;
// case BodyMask.Locomotion:
// break;
// }
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28af9fcbea0c32d4baddcf00cc581d7f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -2,12 +2,13 @@
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAction : MonoBehaviour [AddComponentMenu("")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRAction : MonoBehaviour, ICCK_Component
{ {
[Header("Meta")] [Header("Meta")]
public string actionName; public string actionName;
[Header("Objects")] [Header("Objects")]
public GameObject[] actionObjects; public GameObject[] actionObjects;
} }
} }

View file

@ -1,19 +1,20 @@
using System; using UnityEngine;
using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
[AddComponentMenu("")]
[HelpURL("https://developers.abinteractive.net/cck/components/pointer/")]
public class CVRAdvancedAvatarSettingsPointer : CVRPointer public class CVRAdvancedAvatarSettingsPointer : CVRPointer
{ {
private void OnDrawGizmos() private void OnDrawGizmos()
{ {
if (isActiveAndEnabled) if (!isActiveAndEnabled)
{ return;
Gizmos.color = Color.cyan; Gizmos.color = Color.cyan;
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one); Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
Gizmos.matrix = rotationMatrix; Gizmos.matrix = rotationMatrix;
Gizmos.DrawSphere(Vector3.zero, 0.015f); Gizmos.DrawSphere(Vector3.zero, 0.015f);
} }
} }
}
} }

View file

@ -1,28 +1,29 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAdvancedAvatarSettingsTrigger : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Advanced Avatar Trigger")]
[HelpURL("https://developers.abinteractive.net/cck/components/aas-trigger/")]
[DisallowMultipleComponent]
public class CVRAdvancedAvatarSettingsTrigger : MonoBehaviour, ICCK_Component
{ {
public Vector3 areaSize = new Vector3(0.05f, 0.05f, 0.05f); public Vector3 areaSize = new Vector3(0.05f, 0.05f, 0.05f);
public Vector3 areaOffset = Vector3.zero; public Vector3 areaOffset = Vector3.zero;
public string settingName; public string settingName;
public float settingValue = 0; public float settingValue;
public bool useAdvancedTrigger = false; public bool useAdvancedTrigger;
public bool isLocalInteractable = true;
public bool isNetworkInteractable = true; public bool isNetworkInteractable = true;
[SerializeField] public bool allowParticleInteraction;
public List<CVRPointer> allowedPointer = new List<CVRPointer>();
public string[] allowedTypes = new string[0]; [SerializeField] public List<CVRPointer> allowedPointer = new List<CVRPointer>();
public bool allowParticleInteraction = false; public string[] allowedTypes = Array.Empty<string>();
public List<CVRAdvancedAvatarSettingsTriggerTask> enterTasks = new List<CVRAdvancedAvatarSettingsTriggerTask>(); public List<CVRAdvancedAvatarSettingsTriggerTask> enterTasks = new List<CVRAdvancedAvatarSettingsTriggerTask>();
public List<CVRAdvancedAvatarSettingsTriggerTask> exitTasks = new List<CVRAdvancedAvatarSettingsTriggerTask>(); public List<CVRAdvancedAvatarSettingsTriggerTask> exitTasks = new List<CVRAdvancedAvatarSettingsTriggerTask>();
public List<CVRAdvancedAvatarSettingsTriggerTaskStay> stayTasks = new List<CVRAdvancedAvatarSettingsTriggerTaskStay>(); public List<CVRAdvancedAvatarSettingsTriggerTaskStay> stayTasks = new List<CVRAdvancedAvatarSettingsTriggerTaskStay>();
public enum SampleDirection public enum SampleDirection
@ -39,36 +40,46 @@ namespace ABI.CCK.Components
public void Trigger() public void Trigger()
{ {
} }
public void EnterTrigger() public void EnterTrigger()
{ {
} }
public void ExitTrigger() public void ExitTrigger()
{ {
} }
public void StayTrigger(float percent = 0f) public void StayTrigger(float percent = 0f)
{ {
} }
private void OnDrawGizmosSelected() private void OnDrawGizmosSelected()
{ {
if (isActiveAndEnabled) if (!isActiveAndEnabled)
{ return;
Gizmos.color = Color.cyan; Gizmos.color = Color.cyan;
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale); Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
Gizmos.matrix = rotationMatrix; Gizmos.matrix = rotationMatrix;
Collider collider = gameObject.GetComponent<Collider>();
if (collider == null)
{
if (OnlyHasDistanceTask())
{
Gizmos.DrawSphere(Vector3.zero, areaSize.x);
Gizmos.DrawWireSphere(Vector3.zero, areaSize.x);
}
else
{
Gizmos.DrawCube(areaOffset, areaSize); Gizmos.DrawCube(areaOffset, areaSize);
}
}
Vector3 bounds = new Vector3(areaSize.x * 0.5f, areaSize.y * 0.5f, areaSize.z * 0.5f); Vector3 bounds = new Vector3(areaSize.x * 0.5f, areaSize.y * 0.5f, areaSize.z * 0.5f);
if (stayTasks.Count > 0) if (stayTasks.Count > 0 && !OnlyHasDistanceTask())
{ {
Gizmos.DrawWireCube(areaOffset, areaSize); Gizmos.DrawWireCube(areaOffset, areaSize);
@ -185,10 +196,15 @@ namespace ABI.CCK.Components
} }
} }
} }
private bool OnlyHasDistanceTask()
{
return enterTasks.Count == 0 && exitTasks.Count == 0 && stayTasks.Count > 0 && stayTasks.FindAll(x =>
x.updateMethod != CVRAdvancedAvatarSettingsTriggerTaskStay.UpdateMethod.SetFromDistance).Count == 0;
} }
} }
[System.Serializable] [Serializable]
public class CVRAdvancedAvatarSettingsTriggerTask public class CVRAdvancedAvatarSettingsTriggerTask
{ {
public string settingName; public string settingName;
@ -204,10 +220,10 @@ namespace ABI.CCK.Components
Toggle = 4 Toggle = 4
} }
public CVRAdvancedAvatarSettingsTriggerTask.UpdateMethod updateMethod = UpdateMethod.Override; public UpdateMethod updateMethod = UpdateMethod.Override;
} }
[System.Serializable] [Serializable]
public class CVRAdvancedAvatarSettingsTriggerTaskStay public class CVRAdvancedAvatarSettingsTriggerTaskStay
{ {
public string settingName; public string settingName;
@ -219,8 +235,9 @@ namespace ABI.CCK.Components
SetFromPosition = 1, SetFromPosition = 1,
Add = 2, Add = 2,
Subtract = 3, Subtract = 3,
SetFromDistance = 4
} }
public CVRAdvancedAvatarSettingsTriggerTaskStay.UpdateMethod updateMethod = UpdateMethod.SetFromPosition; public UpdateMethod updateMethod = UpdateMethod.SetFromPosition;
} }
} }

View file

@ -1,26 +1,15 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAdvancedAvatarSettingsTriggerHelper : MonoBehaviour [AddComponentMenu("")] // hidden from the Add Component menu
[HelpURL("https://developers.abinteractive.net/cck/components/aas-trigger-helper/")]
public class CVRAdvancedAvatarSettingsTriggerHelper : MonoBehaviour, ICCK_Component
{ {
public List<CVRAdvancedAvatarSettingsTrigger> triggers = new List<CVRAdvancedAvatarSettingsTrigger>(); //public List<CVRAdvancedAvatarSettingsTrigger> triggers = new List<CVRAdvancedAvatarSettingsTrigger>();
// public void onEnter(int i) { }
public void onEnter(int i) // public void onExit(int i) { }
{ // public void onStay(int i) { }
}
public void onExit(int i)
{
}
public void onStay(int i)
{
}
} }
} }

View file

@ -1,9 +1,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using ABI.CCK.Scripts;
using UnityEngine; using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAnimatorDriver : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Animator Driver")]
[HelpURL("https://developers.abinteractive.net/cck/components/animator-driver/")]
public class CVRAnimatorDriver : MonoBehaviour, ICCK_Component
{ {
public float animatorParameter01; public float animatorParameter01;
public float animatorParameter02; public float animatorParameter02;
@ -22,25 +25,22 @@ namespace ABI.CCK.Components
public float animatorParameter15; public float animatorParameter15;
public float animatorParameter16; public float animatorParameter16;
[HideInInspector] public List<Animator> animators = new();
public List<Animator> animators = new List<Animator>(); public List<string> animatorParameters = new();
[HideInInspector] public List<int> animatorParameterType = new(); // why do we store these? we could cache on start
public List<string> animatorParameters = new List<string>();
[HideInInspector]
public List<int> animatorParameterType = new List<int>();
private void OnDidApplyAnimationProperties() private void OnDidApplyAnimationProperties()
{ {
if (animators.Count >= 1) ApplyAnimatorChange(animators[ 0], animatorParameters[ 0], animatorParameterType[ 0], animatorParameter01); if (animators.Count >= 1) ApplyAnimatorChange(animators[0], animatorParameters[0], animatorParameterType[0], animatorParameter01);
if (animators.Count >= 2) ApplyAnimatorChange(animators[ 1], animatorParameters[ 1], animatorParameterType[ 1], animatorParameter02); if (animators.Count >= 2) ApplyAnimatorChange(animators[1], animatorParameters[1], animatorParameterType[1], animatorParameter02);
if (animators.Count >= 3) ApplyAnimatorChange(animators[ 2], animatorParameters[ 2], animatorParameterType[ 2], animatorParameter03); if (animators.Count >= 3) ApplyAnimatorChange(animators[2], animatorParameters[2], animatorParameterType[2], animatorParameter03);
if (animators.Count >= 4) ApplyAnimatorChange(animators[ 3], animatorParameters[ 3], animatorParameterType[ 3], animatorParameter04); if (animators.Count >= 4) ApplyAnimatorChange(animators[3], animatorParameters[3], animatorParameterType[3], animatorParameter04);
if (animators.Count >= 5) ApplyAnimatorChange(animators[ 4], animatorParameters[ 4], animatorParameterType[ 4], animatorParameter05); if (animators.Count >= 5) ApplyAnimatorChange(animators[4], animatorParameters[4], animatorParameterType[4], animatorParameter05);
if (animators.Count >= 6) ApplyAnimatorChange(animators[ 5], animatorParameters[ 5], animatorParameterType[ 5], animatorParameter06); if (animators.Count >= 6) ApplyAnimatorChange(animators[5], animatorParameters[5], animatorParameterType[5], animatorParameter06);
if (animators.Count >= 7) ApplyAnimatorChange(animators[ 6], animatorParameters[ 6], animatorParameterType[ 6], animatorParameter07); if (animators.Count >= 7) ApplyAnimatorChange(animators[6], animatorParameters[6], animatorParameterType[6], animatorParameter07);
if (animators.Count >= 8) ApplyAnimatorChange(animators[ 7], animatorParameters[ 7], animatorParameterType[ 7], animatorParameter08); if (animators.Count >= 8) ApplyAnimatorChange(animators[7], animatorParameters[7], animatorParameterType[7], animatorParameter08);
if (animators.Count >= 9) ApplyAnimatorChange(animators[ 8], animatorParameters[ 8], animatorParameterType[ 8], animatorParameter09); if (animators.Count >= 9) ApplyAnimatorChange(animators[8], animatorParameters[8], animatorParameterType[8], animatorParameter09);
if (animators.Count >= 10) ApplyAnimatorChange(animators[ 9], animatorParameters[ 9], animatorParameterType[ 9], animatorParameter10); if (animators.Count >= 10) ApplyAnimatorChange(animators[9], animatorParameters[9], animatorParameterType[9], animatorParameter10);
if (animators.Count >= 11) ApplyAnimatorChange(animators[10], animatorParameters[10], animatorParameterType[10], animatorParameter11); if (animators.Count >= 11) ApplyAnimatorChange(animators[10], animatorParameters[10], animatorParameterType[10], animatorParameter11);
if (animators.Count >= 12) ApplyAnimatorChange(animators[11], animatorParameters[11], animatorParameterType[11], animatorParameter12); if (animators.Count >= 12) ApplyAnimatorChange(animators[11], animatorParameters[11], animatorParameterType[11], animatorParameter12);
if (animators.Count >= 13) ApplyAnimatorChange(animators[12], animatorParameters[12], animatorParameterType[12], animatorParameter13); if (animators.Count >= 13) ApplyAnimatorChange(animators[12], animatorParameters[12], animatorParameterType[12], animatorParameter13);
@ -49,17 +49,19 @@ namespace ABI.CCK.Components
if (animators.Count >= 16) ApplyAnimatorChange(animators[15], animatorParameters[15], animatorParameterType[15], animatorParameter16); if (animators.Count >= 16) ApplyAnimatorChange(animators[15], animatorParameters[15], animatorParameterType[15], animatorParameter16);
} }
private void ApplyAnimatorChange(Animator animator, string parameterName, int parameterType, float parameterValue) private void ApplyAnimatorChange(Animator animator, string parameterName, int parameterType,
{ float parameterValue)
if (parameterName != "-none-")
{ {
if (parameterName == CVRCommon.NONE_OR_EMPTY)
return;
switch (parameterType) switch (parameterType)
{ {
case 0: case 0:
animator.SetFloat(parameterName, parameterValue); animator.SetFloat(parameterName, parameterValue);
break; break;
case 1: case 1:
animator.SetInteger(parameterName, (int) parameterValue); animator.SetInteger(parameterName, Mathf.RoundToInt(parameterValue));
break; break;
case 2: case 2:
animator.SetBool(parameterName, parameterValue > 0.5f); animator.SetBool(parameterName, parameterValue > 0.5f);
@ -69,6 +71,51 @@ namespace ABI.CCK.Components
break; break;
} }
} }
private void OnValidate()
{
if (animators.Count > 16) // cap at 16
animators.RemoveRange(16, animators.Count - 16);
// keep the list count in sync by adding/removing elements as needed
if (animatorParameters.Count > animators.Count)
animatorParameters.RemoveRange(animators.Count, animatorParameters.Count - animators.Count);
else while (animatorParameters.Count < animators.Count) animatorParameters.Add(CVRCommon.NONE_OR_EMPTY);
if (animatorParameterType.Count > animators.Count)
animatorParameterType.RemoveRange(animators.Count, animatorParameterType.Count - animators.Count);
else while (animatorParameterType.Count < animators.Count) animatorParameterType.Add(-1); // -1 is invalid
// update the parameter type list
for (int i = 0; i < animators.Count; i++)
{
Animator animator = animators[i];
string parameterName = animatorParameters[i];
if (animator == null || parameterName == CVRCommon.NONE_OR_EMPTY)
{
animatorParameterType[i] = -1;
continue;
}
foreach (AnimatorControllerParameter parameter in animator.parameters)
{
if (parameter.name != parameterName) continue;
// 0 = float, 1 = int, 2 = bool, 3 = trigger
animatorParameterType[i] = parameter.type switch
{
AnimatorControllerParameterType.Float => 0,
AnimatorControllerParameterType.Int => 1,
AnimatorControllerParameterType.Bool => 2,
AnimatorControllerParameterType.Trigger => 3,
_ => -1 // invalid
};
break;
}
}
} }
} }
} }

View file

@ -1,11 +1,12 @@
using System; using ABI.CCK.Scripts;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAssetInfo : MonoBehaviour [AddComponentMenu("")]
[DisallowMultipleComponent]
[HelpURL("https://developers.abinteractive.net/cck/components/asset-info/")]
public class CVRAssetInfo : MonoBehaviour, ICCK_Component
{ {
public enum AssetType public enum AssetType
{ {
@ -14,11 +15,30 @@ namespace ABI.CCK.Components
Spawnable = 3 Spawnable = 3
} }
public AssetType type; public AssetType type;
public string objectId; public string objectId;
[HideInInspector] [HideInInspector]
public string randomNum; public string randomNum;
[HideInInspector]
public string unityVersion;
[HideInInspector]
public string cckVersion;
// just to make sure
private void OnValidate() => Reset();
private void Reset()
{
unityVersion = Application.unityVersion;
cckVersion = $"{CVRCommon.CCK_VERSION_NUMBER}:{CVRCommon.CCK_BUILD_NUMBER}";
if (TryGetComponent(out CVRAvatar _))
type = AssetType.Avatar;
if (TryGetComponent(out CVRWorld _))
type = AssetType.World;
if (TryGetComponent(out CVRSpawnable _))
type = AssetType.Spawnable;
}
} }
} }

View file

@ -4,7 +4,9 @@ using UnityEngine.Events;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAttachment : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Attachment")]
[HelpURL("https://developers.abinteractive.net/cck/components/attachment/")]
public class CVRAttachment : MonoBehaviour, ICCK_Component
{ {
[System.Flags] [System.Flags]
public enum AttachmentType public enum AttachmentType

View file

@ -1,74 +1,95 @@
using System.Collections.Generic; using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEngine; using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAudioDriver : MonoBehaviour [HelpURL("https://developers.abinteractive.net/cck/components/audio-driver/")]
public class CVRAudioDriver : MonoBehaviour, ICCK_Component
{ {
public AudioSource audioSource; public AudioSource audioSource;
[SerializeField] [SerializeField]
public List<AudioClip> audioClips = new List<AudioClip>(); public List<AudioClip> audioClips = new List<AudioClip>();
public int selectedAudioClip = 0; public int selectedAudioClip;
public bool playOnSwitch = true; public bool playOnSwitch = true;
private int _selectedAudioClip = 0; private int _selectedAudioClip;
private void OnDidApplyAnimationProperties() #region Unity Events
private void OnValidate() => CheckAndUpdateAudioClip(); // Editor testing
private void OnDidApplyAnimationProperties() => CheckAndUpdateAudioClip();
#endregion
#region Public Methods
[PublicAPI]
public void PlaySound(int index)
=> SetAndMaybePlay(index);
[PublicAPI]
public void PlaySound()
{
if (audioSource != null && audioSource.isActiveAndEnabled)
audioSource.Play();
}
[PublicAPI]
public void PlayNext()
{
if (_selectedAudioClip + 1 >= audioClips.Count)
PlaySound(0);
else
PlaySound(_selectedAudioClip + 1);
}
[PublicAPI]
public void PlayPrev()
{
if (_selectedAudioClip == 0)
PlaySound(audioClips.Count - 1);
else
PlaySound(_selectedAudioClip - 1);
}
[PublicAPI]
public void SelectRandomSound()
=> SetAndMaybePlay(Random.Range(0, audioClips.Count));
#endregion
#region Private Methods
private void CheckAndUpdateAudioClip()
{ {
if (selectedAudioClip != _selectedAudioClip) if (selectedAudioClip != _selectedAudioClip)
{ SetAndMaybePlay(selectedAudioClip);
if(SetAudioClip(selectedAudioClip) && playOnSwitch) PlaySound();
} }
private void SetAndMaybePlay(int index)
{
if (SetAudioClip(index) && playOnSwitch)
PlaySound();
} }
private bool SetAudioClip(int index) private bool SetAudioClip(int index)
{ {
if (index < audioClips.Count) _selectedAudioClip = index;
{
if (audioClips[index] != null && audioSource != null) if (index >= audioClips.Count
{ || index < 0)
return false;
if (audioClips[index] == null
|| audioSource == null)
return false;
audioSource.clip = audioClips[index]; audioSource.clip = audioClips[index];
_selectedAudioClip = selectedAudioClip;
return true; return true;
} }
}
return false; #endregion
}
public void PlaySound(int index)
{
if (SetAudioClip(index)) PlaySound();
}
public void PlaySound()
{
if (audioSource != null) audioSource.Play();
}
public void PlayNext()
{
if (_selectedAudioClip + 1 >= audioClips.Count)
{
PlaySound(0);
}
else
{
PlaySound(_selectedAudioClip + 1);
}
}
public void PlayPrev()
{
if (_selectedAudioClip == 0)
{
PlaySound(audioClips.Count - 1);
}
else
{
PlaySound(_selectedAudioClip - 1);
}
}
public void SelectRandomSound()
{
if (SetAudioClip(Random.Range(0, audioClips.Count)) && playOnSwitch) PlaySound();
}
} }
} }

View file

@ -3,7 +3,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAudioMaterialParser : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Audio Material Parser")]
[HelpURL("https://developers.abinteractive.net/cck/components/audio-material-parser/")]
public class CVRAudioMaterialParser : MonoBehaviour, ICCK_Component
{ {
public bool useSeparateAudioSources = false; public bool useSeparateAudioSources = false;

View file

@ -1,58 +1,224 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq;
using ABI.CCK.Scripts; using ABI.CCK.Scripts;
using UnityEngine; using UnityEngine;
using UnityEngine.Animations;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
[RequireComponent(typeof(CVRAssetInfo))]
[RequireComponent(typeof(Animator))]
[ExecuteInEditMode] [ExecuteInEditMode]
public class CVRAvatar : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Avatar")]
[HelpURL("https://developers.abinteractive.net/cck/components/avatar/")]
[RequireComponent(typeof(Animator))]
public class CVRAvatar : MonoBehaviour, ICCK_Component
{ {
public enum CVRAvatarVoiceParent #region Editor Methods
public void Reset()
{ {
Head = 0, if (GetComponent<CVRAssetInfo>() != null) return;
LeftHand = 2, CVRAssetInfo info = gameObject.AddComponent<CVRAssetInfo>();
RightHand = 3, info.type = CVRAssetInfo.AssetType.Avatar;
Hips = 4
} }
[Space] [Header("General avatar settings")] [Space] #endregion
#region CVRAvatarEnums
public enum CVRAvatarVoiceParent { Head = 0, LeftHand = 2, RightHand = 3, Hips = 4 }
public enum CVRAvatarVisemeMode { Visemes = 0, SingleBlendshape = 1, JawBone = 2 }
#endregion
#region General Avatar Settings
//[Space] [Header("General Avatar Settings")] [Space]
public Vector3 viewPosition = new Vector3(0, 0.1f, 0); public Vector3 viewPosition = new Vector3(0, 0.1f, 0);
public Vector3 voicePosition = new Vector3(0, 0.1f, 0); public Vector3 voicePosition = new Vector3(0, 0.15f, 0);
public CVRAvatarVoiceParent voiceParent = CVRAvatarVoiceParent.Head; public CVRAvatarVoiceParent voiceParent = CVRAvatarVoiceParent.Head;
public bool useEyeMovement = true;
public bool useBlinkBlendshapes; #endregion
public bool useVisemeLipsync;
#region Avatar Customization
//[Space] [Header("Avatar Customization")] [Space]
public AnimatorOverrideController overrides;
public SkinnedMeshRenderer bodyMesh; public SkinnedMeshRenderer bodyMesh;
public string[] blinkBlendshape = new string[4]; /// <summary>
/// Interval to change targets for the eye movement in seconds
/// </summary>
[SerializeField] public Vector2 eyeMovementInterval = new(5f, 10f);
public enum CVRAvatarVisemeMode #endregion
#region Eye Look Settings
/// <summary>
/// Whether to use Eye Movement or not
/// </summary>
[SerializeField] public bool useEyeMovement = true;
/// <summary>
/// Structure holding the detailed information for the eye movement
/// </summary>
[SerializeField] public EyeMovementInfo eyeMovementInfo = new EyeMovementInfo();
// Limits for the eye movement interval
[NonSerialized] public const float EyeMovementMinIntervalLimit = 1f;
[NonSerialized] public const float EyeMovementMaxIntervalLimit = 30f;
// Limits for the eye angles (uses the same as the default eye muscle values in unity)
[NonSerialized] public const float DefaultEyeAngleLimitDown = -10;
[NonSerialized] public const float DefaultEyeAngleLimitUp = 15;
[NonSerialized] public const float DefaultEyeAngleLimitIn = -20;
[NonSerialized] public const float DefaultEyeAngleLimitOut = 20;
// Limits for the eye angles when we need uniform limits (useful for the blend shape type)
[NonSerialized] public const float DefaultUniformAngleLimit = 25;
[Serializable] public enum CVRAvatarEyeLookMode
{ {
Visemes = 0, /// <summary>
SingleBlendshape = 1, /// Eye movement muscle setup
JawBone = 2 /// </summary>
Muscle = 0,
/// <summary>
/// Disabled eye movement setup
/// </summary>
None = 1,
/// <summary>
/// Eye movement transforms setup
/// </summary>
Transform = 2,
/// <summary>
/// Eye movement blendshape setup
/// </summary>
Blendshape = 3,
} }
[Serializable] public struct EyeMovementInfo
{
/// <summary>
/// Type of eye movement. It will dictate which fields will be used.
/// </summary>
[SerializeField] [NotKeyable] public CVRAvatarEyeLookMode type;
/// <summary>
/// Relevant to: Transforms and Blendshapes
/// Eyes info for the eyes, not all fields will be used
/// </summary>
[SerializeReference] public EyeMovementInfoEye[] eyes;
}
[Serializable] public class EyeMovementInfoEye
{
/// <summary>
/// Relevant to: Transforms and Blendshapes
/// Whether the eye is Left or not (this is only used to manage the in/out limit direction)
/// </summary>
[SerializeField] public bool isLeft;
/// <summary>
/// Transforms - Transform of the eye bone
/// Blendshapes - Transform where the eye should be
/// </summary>
[SerializeField] [NotKeyable] public Transform eyeTransform;
/// <summary>
/// Blendshapes - Skinned mesh renderer for the renderer that has the blendshapes to be driven
/// </summary>
[SerializeField] [NotKeyable] public SkinnedMeshRenderer eyeSkinnedMeshRenderer;
/// <summary>
/// Transforms - Angle limits for the transforms in degrees
/// Blendshapes - Min/Max angle limits for which the blendshapes should be set to 100
/// </summary>
[SerializeField] public float eyeAngleLimitDown;
[SerializeField] public float eyeAngleLimitUp;
[SerializeField] public float eyeAngleLimitIn;
[SerializeField] public float eyeAngleLimitOut;
/// <summary>
/// Blendshapes - Blenshapes to be used for the blendshape eye movement
/// </summary>
[SerializeField] [NotKeyable] public string eyeBlendShapeUp;
[SerializeField] [NotKeyable] public string eyeBlendShapeDown;
[SerializeField] [NotKeyable] public string eyeBlendShapeIn;
[SerializeField] [NotKeyable] public string eyeBlendShapeOut;
}
#endregion
#region Eye Blink Settings
/// <summary>
/// Whether to use blendshapes to blink or not
/// </summary>
[SerializeField] public bool useBlinkBlendshapes;
/// <summary>
/// Which blendshapes to use when blinking (they're all used at the same time)
/// </summary>
[SerializeField] public string[] blinkBlendshape = new string[4];
/// <summary>
/// Time interval between blinks in seconds.
/// </summary>
[SerializeField] public Vector2 blinkGap = new(3.0f, 8.0f);
[NonSerialized] public const float BlinkMinGapLimit = 0.1f;
[NonSerialized] public const float BlinkMaxGapLimit = 30f;
/// <summary>
/// Duration of the blink in seconds.
/// </summary>
[SerializeField] public Vector2 blinkDuration = new(0.25f, 0.35f);
[NonSerialized] public const float BlinkMinDurationLimit = 0.1f;
[NonSerialized] public const float BlinkMaxDurationLimit = 3f;
#endregion
#region Lip Sync Settings
//[Space] [Header("Lip Sync Settings")] [Space]
public bool useVisemeLipsync;
public CVRAvatarVisemeMode visemeMode = CVRAvatarVisemeMode.Visemes; public CVRAvatarVisemeMode visemeMode = CVRAvatarVisemeMode.Visemes;
[Range(1, 100)] public int visemeSmoothing = 50;
public int visemeSmoothing = 50;
public string[] visemeBlendshapes = new string[15]; public string[] visemeBlendshapes = new string[15];
[Space] [Header("Avatar customization")] [Space] #endregion
public AnimatorOverrideController overrides;
public bool enableAdvancedTagging = false; #region First Person Render Settings (Deprecated)
#if UNITY_EDITOR // This is a deprecated feature, so lets not included in builds
[NotKeyable] public bool enableCustomFPR;
public List<CVRAvatarFPREntry> fprSettingsList;
#endif
#endregion
#region Advanced Tagging
//[Space] [Header("Advanced Tagging")] [Space]
[NotKeyable]
public bool enableAdvancedTagging;
public List<CVRAvatarAdvancedTaggingEntry> advancedTaggingList = new List<CVRAvatarAdvancedTaggingEntry>(); public List<CVRAvatarAdvancedTaggingEntry> advancedTaggingList = new List<CVRAvatarAdvancedTaggingEntry>();
public bool avatarUsesAdvancedSettings = false; #endregion
public CVRAdvancedAvatarSettings avatarSettings = null;
void OnDrawGizmosSelected() #region Advanced Settings
//[Space] [Header("Advanced Settings")] [Space]
[NotKeyable]
public bool avatarUsesAdvancedSettings;
public CVRAdvancedAvatarSettings avatarSettings;
#endregion
#region Unity Methods
private void OnDrawGizmosSelected()
{ {
var scale = transform.localScale; Vector3 scale = transform.localScale;
scale.x = 1 / scale.x; scale.x = 1 / scale.x;
scale.y = 1 / scale.y; scale.y = 1 / scale.y;
scale.z = 1 / scale.z; scale.z = 1 / scale.z;
@ -64,17 +230,127 @@ namespace ABI.CCK.Components
Gizmos.DrawSphere(transform.TransformPoint(Vector3.Scale(voicePosition, scale)), 0.01f); Gizmos.DrawSphere(transform.TransformPoint(Vector3.Scale(voicePosition, scale)), 0.01f);
} }
private void OnEnable() #endregion
#region Parameter Sync Usage
#if UNITY_EDITOR
public (int, int) GetParameterSyncUsage()
{ {
CVRAssetInfo info = gameObject.GetComponent<CVRAssetInfo>(); if (avatarSettings?.settings == null)
info.type = CVRAssetInfo.AssetType.Avatar; return (0, 0);
var animatorParameterNames = new HashSet<string>();
int syncedValuesOverrides = 0, syncedBooleansOverrides = 0;
int syncedValuesAASAutoGen = 0, syncedBooleansAASAutoGen = 0;
// Count override controller (real count)
if (overrides != null && overrides.runtimeAnimatorController != null)
{
foreach (AnimatorControllerParameter parameter in CVRCommon.GetParametersFromController(
overrides.runtimeAnimatorController, CVRCommon.NonCoreFilter, CVRCommon.NonLocalFilter))
{
if (!animatorParameterNames.Add(parameter.name))
continue;
if (parameter.type == AnimatorControllerParameterType.Bool)
syncedBooleansOverrides++;
else if (parameter.type != AnimatorControllerParameterType.Trigger)
syncedValuesOverrides++;
}
} }
animatorParameterNames.Clear();
// Count baseController (part of autogen)
if (avatarSettings.baseController != null)
{
foreach (AnimatorControllerParameter parameter in CVRCommon.GetParametersFromController(
avatarSettings.baseController, CVRCommon.NonCoreFilter, CVRCommon.NonLocalFilter))
{
if (!animatorParameterNames.Add(parameter.name))
continue;
if (parameter.type == AnimatorControllerParameterType.Bool)
syncedBooleansAASAutoGen++;
else if (parameter.type != AnimatorControllerParameterType.Trigger)
syncedValuesAASAutoGen++;
}
} }
[System.Serializable] // Count menu entries (part of autogen, not real)
foreach (CVRAdvancedSettingsEntry entry in avatarSettings.settings)
{
if (IsValidParameter(entry.machineName) && animatorParameterNames.Add(entry.machineName))
{
switch (entry.type)
{
case CVRAdvancedSettingsEntry.SettingsType.Toggle:
if (entry.setting.usedType == CVRAdvancesAvatarSettingBase.ParameterType.Bool)
syncedBooleansAASAutoGen += 1;
else
syncedValuesAASAutoGen += 1;
break;
case CVRAdvancedSettingsEntry.SettingsType.Color:
IncrementSyncValuesForEntry(entry, animatorParameterNames, ref syncedValuesAASAutoGen, "-r", "-g", "-b");
break;
case CVRAdvancedSettingsEntry.SettingsType.Joystick2D:
case CVRAdvancedSettingsEntry.SettingsType.InputVector2:
IncrementSyncValuesForEntry(entry, animatorParameterNames, ref syncedValuesAASAutoGen, "-x", "-y");
break;
case CVRAdvancedSettingsEntry.SettingsType.Joystick3D:
case CVRAdvancedSettingsEntry.SettingsType.InputVector3:
IncrementSyncValuesForEntry(entry, animatorParameterNames, ref syncedValuesAASAutoGen, "-x", "-y", "-z");
break;
case CVRAdvancedSettingsEntry.SettingsType.Slider:
case CVRAdvancedSettingsEntry.SettingsType.InputSingle:
case CVRAdvancedSettingsEntry.SettingsType.Dropdown:
default:
syncedValuesAASAutoGen += 1;
break;
}
}
}
int realUsage = syncedValuesOverrides * 32 + Mathf.CeilToInt(syncedBooleansOverrides / 8f) * 8;
int autogenUsage = syncedValuesAASAutoGen * 32 + Mathf.CeilToInt(syncedBooleansAASAutoGen / 8f) * 8;
return (realUsage, autogenUsage);
}
private static bool IsValidParameter(string parameterName)
{
return !string.IsNullOrEmpty(parameterName) && !CVRCommon.CoreParameters.Contains(parameterName) &&
!parameterName.StartsWith(CVRCommon.LOCAL_PARAMETER_PREFIX);
}
private static void IncrementSyncValuesForEntry(CVRAdvancedSettingsEntry entry, HashSet<string> animatorParameters, ref int syncedValues, params string[] suffixes)
{
int newSyncedValues = suffixes.Count(suffix => animatorParameters.Add(entry.machineName + suffix));
syncedValues += newSyncedValues;
}
#endif
#endregion
}
#region First Person Render Class
[Serializable]
public class CVRAvatarFPREntry
{
public bool visibility = true;
public Transform transform;
}
#endregion
#region Advanced Tagging Class
[Serializable]
public class CVRAvatarAdvancedTaggingEntry public class CVRAvatarAdvancedTaggingEntry
{ {
[Flags]
public enum Tags public enum Tags
{ {
LoudAudio = 1, LoudAudio = 1,
@ -88,10 +364,10 @@ namespace ABI.CCK.Components
Nudity = 256, Nudity = 256,
Horror = 512 Horror = 512
} }
public Tags tags = 0; public Tags tags = 0;
public GameObject gameObject; public GameObject gameObject;
public GameObject fallbackGameObject; public GameObject fallbackGameObject;
} }
#endregion
} }

View file

@ -1,11 +1,17 @@
using UnityEngine; using System;
using JetBrains.Annotations;
using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRAvatarPickupMarker : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Avatar Pickup Marker")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRAvatarPickupMarker : MonoBehaviour, ICCK_Component
{ {
public string avatarGuid; public string avatarGuid;
#region Unity Events
private void OnDrawGizmos() private void OnDrawGizmos()
{ {
Gizmos.color = Color.magenta; Gizmos.color = Color.magenta;
@ -23,5 +29,23 @@ namespace ABI.CCK.Components
Gizmos.matrix = rotationMatrix; Gizmos.matrix = rotationMatrix;
Gizmos.DrawWireSphere(new Vector3(0, 1.11f, 0), 0.31f); Gizmos.DrawWireSphere(new Vector3(0, 1.11f, 0), 0.31f);
} }
#endregion Unity Events
#region Public Methods
[PublicAPI]
public void ShowAvatarDetailsPage()
{
}
[PublicAPI]
public void ChangeAvatar()
{
}
#endregion Public Methods
} }
} }

View file

@ -0,0 +1,54 @@
using System;
using ABI.CCK.Components.ScriptableObjects;
using UnityEngine;
using UnityEngine.Animations;
namespace ABI.CCK.Components
{
/// <summary>
/// Common things that both CVRLuaClientBehaviour, and CVRLuaServerBehaviour use.
///
/// ********************************
/// * Do not use if you're a user. *
/// ********************************
///
/// Use CVRLuaClientBehaviour if you're making a client-side script.
/// - or -
/// Use CVRLuaServerBehaviour if you're making a server-side script.
/// </summary>
public abstract class CVRBaseLuaBehaviour : MonoBehaviour
{
public string ScriptName => asset == null ? string.Empty : asset.name;
public string ScriptText => asset == null ? string.Empty : asset.m_ScriptText;
public string ScriptPath => asset == null ? string.Empty : asset.m_ScriptPath;
/// <summary>
/// Whether a script is only supposed to run locally or not.
/// Avatars: The script only runs on the avatar's wearer client
/// Props: The script only runs on prop spawner's client
/// World: Ignores this setting for now
/// </summary>
[SerializeField] [NotKeyable]
public bool localOnly = true;
/// <summary>
/// The actual text-asset that we get the content of the script from.
/// </summary>
public CVRLuaScript asset;
/// <summary>
/// A thing in the scene we want to link to this script.
/// </summary>
[Serializable]
public struct BoundObject
{
public string name;
public UnityEngine.Object boundThing;
}
/// <summary>
/// A list of things in the scene we want to link to this script.
/// </summary>
public BoundObject[] boundObjects;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: de2e0e3526ad8ea45a48ed7a7b5a7b5c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,9 +1,68 @@
using UnityEngine; using UnityEngine;
[AddComponentMenu("ChilloutVR/CVR Blitter")]
[HelpURL("https://developers.abinteractive.net/cck/components/blitter/")]
public class CVRBlitter : MonoBehaviour public class CVRBlitter : MonoBehaviour
{ {
[SerializeField] RenderTexture originTexture = null; public RenderTexture originTexture;
[SerializeField] RenderTexture destinationTexture = null; public RenderTexture destinationTexture;
[SerializeField] Material blitMaterial = null; public Material blitMaterial;
public bool clearEveryFrame; public bool clearEveryFrame;
private bool _isInitialized;
private void Start()
{
_isInitialized = true;
OnEnable();
}
private void OnEnable()
{
if (!_isInitialized) return;
Camera.onPreRender += MyOnPreRender;
}
private void OnDisable()
{
Camera.onPreRender -= MyOnPreRender;
}
private void MyOnPreRender(Camera cam)
{
if (!enabled)
return;
// Don't blit unless it's the main camera
if (cam != Camera.main)
return;
if (originTexture == null
|| destinationTexture == null
|| blitMaterial == null)
{
enabled = false;
return;
}
if (clearEveryFrame)
{
RenderTexture rt = RenderTexture.active;
RenderTexture.active = destinationTexture;
GL.Clear(true, true, Color.clear);
RenderTexture.active = rt;
}
if (originTexture == destinationTexture)
{
RenderTexture temp = RenderTexture.GetTemporary(destinationTexture.descriptor);
Graphics.Blit(originTexture, temp, blitMaterial);
Graphics.CopyTexture(temp, destinationTexture);
RenderTexture.ReleaseTemporary(temp);
return;
}
Graphics.Blit(originTexture, destinationTexture, blitMaterial);
}
} }

View file

@ -1,18 +1,14 @@
using System; using UnityEngine;
using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRBuilderSpawnable : MonoBehaviour [AddComponentMenu("")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRBuilderSpawnable : MonoBehaviour, ICCK_Component
{ {
private void Reset() private void Reset()
{ {
if (GetComponent<CVRSpawnable>() != null) if (GetComponent<CVRSpawnable>() != null)
{
Invoke("DestroyThis", 0);
}
}
void DestroyThis() {
DestroyImmediate(this); DestroyImmediate(this);
} }
} }

View file

@ -3,7 +3,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRCameraHelper : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Camera Helper")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRCameraHelper : MonoBehaviour, ICCK_Component
{ {
public Camera cam; public Camera cam;
public bool setAsMirroringCamera; public bool setAsMirroringCamera;

View file

@ -1,10 +1,10 @@
using System;
using UnityEngine; using UnityEngine;
using UnityEngine.PlayerLoop;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRCustomRenderTextureUpdater : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Custom Render Texture Updater")]
[HelpURL("https://developers.abinteractive.net/cck/components/custom-render-texture-updater/")]
public class CVRCustomRenderTextureUpdater : MonoBehaviour, ICCK_Component
{ {
public CustomRenderTexture customRenderTexture; public CustomRenderTexture customRenderTexture;

View file

@ -2,7 +2,9 @@
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRDescription : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Description")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRDescription : MonoBehaviour, ICCK_Component
{ {
public string description; public string description;
public string url; public string url;

View file

@ -1,11 +1,11 @@
using System.ComponentModel; using UnityEngine;
using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
[ExecuteInEditMode] [ExecuteInEditMode]
[AddComponentMenu("Scripts/CVR Distance Constraint")] [AddComponentMenu("ChilloutVR/CVR Distance Constraint")]
public class CVRDistanceConstrain : MonoBehaviour [HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRDistanceConstrain : MonoBehaviour, ICCK_Component
{ {
public Transform target; public Transform target;
public float minDistance = 0; public float minDistance = 0;

View file

@ -4,7 +4,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRDistanceLod : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Distance Lod")]
[HelpURL("https://developers.abinteractive.net/cck/components/distance-lod/")]
public class CVRDistanceLod : MonoBehaviour, ICCK_Component
{ {
public bool distance3D = false; public bool distance3D = false;
public List<CVRDistanceLodGroup> Groups = new List<CVRDistanceLodGroup>(); public List<CVRDistanceLodGroup> Groups = new List<CVRDistanceLodGroup>();

View file

@ -3,7 +3,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRFaceTracking : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Face Tracking")]
[HelpURL("https://developers.abinteractive.net/cck/components/face-tracking/")]
public class CVRFaceTracking : MonoBehaviour, ICCK_Component
{ {
public bool UseFacialTracking = true; public bool UseFacialTracking = true;
public float BlendShapeStrength = 100f; public float BlendShapeStrength = 100f;
@ -41,8 +43,11 @@ namespace ABI.CCK.Components
} }
} }
public void FindVisemes() public void AutoSelectFaceTrackingShapes()
{ {
#if UNITY_EDITOR
UnityEditor.Undo.RecordObject(this, "CVR Auto Select Face Tracking");
#endif
for (int i = 0; i < FaceBlendShapeNames.Length; i++) for (int i = 0; i < FaceBlendShapeNames.Length; i++)
{ {
for (int j = 0; j < BlendShapeNames.Count; ++j) for (int j = 0; j < BlendShapeNames.Count; ++j)

View file

@ -2,10 +2,14 @@
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
[AddComponentMenu("ChilloutVR/CVR GI Material Updater")]
[HelpURL("https://developers.abinteractive.net/cck/components/gi-material-updater/")]
[RequireComponent(typeof(Renderer))] [RequireComponent(typeof(Renderer))]
public class CVRGIMaterialUpdater : MonoBehaviour public class CVRGIMaterialUpdater : MonoBehaviour, ICCK_Component
{ {
#pragma warning disable 649
[SerializeField] bool updateEveryFrame; [SerializeField] bool updateEveryFrame;
#pragma warning restore 649
private Renderer _renderer; private Renderer _renderer;
private void Start() private void Start()
@ -18,6 +22,5 @@ namespace ABI.CCK.Components
if (_renderer == null || !updateEveryFrame) return; if (_renderer == null || !updateEveryFrame) return;
_renderer.UpdateGIMaterials(); _renderer.UpdateGIMaterials();
} }
} }
} }

View file

@ -1,32 +1,79 @@
using System; using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine; using UnityEngine;
using UnityEngine.Animations;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRGlobalMaterialPropertyUpdater : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Global Material Property Updater")]
[HelpURL("https://developers.abinteractive.net/cck/components/global-material-property-updater/")]
public class CVRGlobalMaterialPropertyUpdater : MonoBehaviour, ICCK_Component
{ {
public Material material;
public enum PropertyType public enum PropertyType
{ {
// For legacy reasons, this was used for Int type in shader. Needed for legacy content.
// In reality it represents a float, and should be handled like a float.
// Newer content will use paramFloat for Int shader types (because it's what it is)
paramInt = 0, paramInt = 0,
paramFloat = 1, paramFloat = 1,
paramVector4 = 2 paramVector4 = 2,
// The true Integer, this was added in unity 2021. The shader type is Integer
paramInteger = 3,
} }
[SerializeField, NotKeyable]
public Material material;
[SerializeField, NotKeyable]
public string propertyName; public string propertyName;
[SerializeField, NotKeyable]
public PropertyType propertyType = PropertyType.paramFloat; public PropertyType propertyType = PropertyType.paramFloat;
// Variables only used to populate the cvr interactable set property value
[NonSerialized]
public int intValue; public int intValue;
[NonSerialized]
public float floatValue; public float floatValue;
[NonSerialized]
public Vector4 vector4Value; public Vector4 vector4Value;
[NonSerialized]
public int integerValue;
private void Start() // Animatable parameters, value changes to these will trigger material updates
{ [SerializeField, CVRInteractableActionOperation.HideFromSetPropertyByValue]
public int intValueAnimatable;
[SerializeField, CVRInteractableActionOperation.HideFromSetPropertyByValue]
public float floatValueAnimatable;
[SerializeField, CVRInteractableActionOperation.HideFromSetPropertyByValue]
public Vector4 vector4ValueAnimatable;
[SerializeField, CVRInteractableActionOperation.HideFromSetPropertyByValue]
public int integerValueAnimatable;
#if UNITY_EDITOR
private void OnValidate() {
if (material == null || material.shader.FindPropertyIndex(propertyName) < 0 || AnimationMode.InAnimationMode()) return;
// Fetch the default value from the material
switch (propertyType) {
case PropertyType.paramInt:
intValueAnimatable = material!.GetInt(propertyName);
break;
case PropertyType.paramFloat:
floatValueAnimatable = material!.GetFloat(propertyName);
break;
case PropertyType.paramVector4:
vector4ValueAnimatable = material!.GetVector(propertyName);
break;
case PropertyType.paramInteger:
integerValueAnimatable = material!.GetInteger(propertyName);
break;
} }
} }
#endif
}
} }

View file

@ -3,7 +3,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRGlobalShaderUpdater : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Global Shader Updater")]
[HelpURL("https://developers.abinteractive.net/cck/components/global-shader-updater/")]
public class CVRGlobalShaderUpdater : MonoBehaviour, ICCK_Component
{ {
public bool updateValues = true; public bool updateValues = true;

View file

@ -2,7 +2,9 @@
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRHapticAreaChest : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Haptic Area Chest")]
[HelpURL("https://developers.abinteractive.net/cck/components/haptic-chest-area/")]
public class CVRHapticAreaChest : MonoBehaviour, ICCK_Component
{ {
public Vector3 chestAreaSize = new Vector3(0.05f, 0.05f, 0.05f); public Vector3 chestAreaSize = new Vector3(0.05f, 0.05f, 0.05f);

View file

@ -2,7 +2,9 @@
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRHapticZone : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Haptic Zone")]
[HelpURL("https://developers.abinteractive.net/cck/components/haptic-zone/")]
public class CVRHapticZone : MonoBehaviour, ICCK_Component
{ {
public enum TriggerForm public enum TriggerForm
{ {

View file

@ -1,5 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
@ -7,8 +5,10 @@ using UnityEngine.Events;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
[AddComponentMenu("ChilloutVR/CVR Interactable")]
[HelpURL("https://developers.abinteractive.net/cck/components/interactable/")]
[System.Serializable] [System.Serializable]
public class CVRInteractable : MonoBehaviour public class CVRInteractable : MonoBehaviour, ICCK_Component
{ {
public string tooltip; public string tooltip;
public List<CVRInteractableAction> actions = new List<CVRInteractableAction>(); public List<CVRInteractableAction> actions = new List<CVRInteractableAction>();
@ -29,24 +29,86 @@ namespace ABI.CCK.Components
{ {
if (operation.type == CVRInteractableActionOperation.ActionType.TeleportPlayer) if (operation.type == CVRInteractableActionOperation.ActionType.TeleportPlayer)
{ {
Gizmos.color = Color.green;
if(operation.gameObjectVal == null) continue; if(operation.gameObjectVal == null) continue;
Gizmos.DrawLine(transform.position, operation.gameObjectVal.transform.position);
DrawArrow(operation.gameObjectVal.transform.position, new Vector3(0, operation.gameObjectVal.transform.eulerAngles.y, 0), 1); Transform target = operation.gameObjectVal.transform;
Vector3 position = target.position;
// connection line
Gizmos.color = Color.yellow;
Gizmos.DrawLine(transform.position, position);
// alignment is set to none
if (operation.floatVal == 3)
{
Gizmos.color = Color.blue;
Gizmos.DrawWireSphere(position, 0.1f);
continue;
}
// relative teleport sets forward direction
Vector3 targetDirection;
if (operation.boolVal)
{
Gizmos.color = Color.cyan;
targetDirection = transform.InverseTransformDirection(transform.forward);
targetDirection = target.TransformDirection(targetDirection);
}
else
{
Gizmos.color = Color.blue;
targetDirection = target.forward;
}
if (operation.floatVal == 0) targetDirection = Vector3.ProjectOnPlane(targetDirection, Vector3.up).normalized;
DrawArrow(position, targetDirection, 1);
// up direction, when gravity, aligns to sampled gravity on teleport
Gizmos.color = operation.floatVal == 2 ? Color.magenta : Color.green;
switch (operation.floatVal)
{
case 0: // World Up
DrawArrow(position, Vector3.up, 1);
break;
case 1: // Target Up
case 2: // Gravity
DrawArrow(position, target.up, 1);
break;
}
} }
if (operation.type == CVRInteractableActionOperation.ActionType.SitAtPosition) if (operation.type == CVRInteractableActionOperation.ActionType.SitAtPosition)
{ {
Gizmos.color = Color.blue; if(operation.targets.Count > 0 && operation.targets[0] == null)
if(operation.targets.Count > 0 && operation.targets[0] == null) continue; continue;
Gizmos.DrawLine(transform.position, operation.targets[0].transform.position);
DrawArrow(operation.targets[0].transform.position, new Vector3(0, operation.targets[0].transform.eulerAngles.y, 0), 0.5f);
if (operation.gameObjectVal == null) continue; // Exit position
var position = operation.gameObjectVal.transform; Gizmos.color = Color.blue;
Transform exitTransform = operation.targets[0].transform;
Vector3 exitPosition = exitTransform.position;
Gizmos.DrawLine(transform.position, exitPosition);
DrawArrow(exitPosition,
exitTransform.forward, 0.5f);
Gizmos.color = Color.yellow;
DrawArrow(exitPosition,
exitTransform.up, 0.5f);
if (operation.gameObjectVal == null)
continue;
Gizmos.color = Color.blue;
// Sitting position
Transform position = operation.gameObjectVal.transform;
Gizmos.DrawLine(transform.position, position.position); Gizmos.DrawLine(transform.position, position.position);
Matrix4x4 rotationMatrix = Matrix4x4.TRS(position.position, position.rotation, Vector3.one);
Gizmos.matrix = rotationMatrix; // Draws sitting cube person
Gizmos.matrix = Matrix4x4.TRS(position.position, position.rotation, Vector3.one);
Gizmos.DrawWireCube(new Vector3(+0.12f, -0.2f, 0.05f), new Vector3(0.1f, 0.4f, 0.1f)); Gizmos.DrawWireCube(new Vector3(+0.12f, -0.2f, 0.05f), new Vector3(0.1f, 0.4f, 0.1f));
Gizmos.DrawWireCube(new Vector3(-0.12f, -0.2f, 0.05f), new Vector3(0.1f, 0.4f, 0.1f)); Gizmos.DrawWireCube(new Vector3(-0.12f, -0.2f, 0.05f), new Vector3(0.1f, 0.4f, 0.1f));
Gizmos.DrawWireCube(new Vector3(+0.12f, 0.05f, -0.2f), new Vector3(0.1f, 0.1f, 0.6f)); Gizmos.DrawWireCube(new Vector3(+0.12f, 0.05f, -0.2f), new Vector3(0.1f, 0.1f, 0.6f));
@ -62,24 +124,24 @@ namespace ABI.CCK.Components
} }
} }
private void DrawArrow(Vector3 position, Vector3 angle, float size) private void DrawArrow(Vector3 position, Vector3 direction, float size)
{ {
var a1 = position + new Vector3(0, 0.1f * size, 0); var a1 = RotatePointAroundPivot(position + new Vector3(0, 0.1f * size, 0), position, direction);
var a2 = RotatePointAroundPivot(position + new Vector3(0.1f * size, 0, 0), position, angle); var a2 = RotatePointAroundPivot(position + new Vector3(0.1f * size, 0, 0), position, direction);
var a3 = position + new Vector3(0, -0.1f * size, 0); var a3 = RotatePointAroundPivot(position + new Vector3(0, -0.1f * size, 0), position, direction);
var a4 = RotatePointAroundPivot(position + new Vector3(-0.1f * size, 0, 0), position, angle); var a4 = RotatePointAroundPivot(position + new Vector3(-0.1f * size, 0, 0), position, direction);
var b1 = RotatePointAroundPivot(position + new Vector3(0, 0.1f * size, 0.3f * size), position, angle); var b1 = RotatePointAroundPivot(position + new Vector3(0, 0.1f * size, 0.3f * size), position, direction);
var b2 = RotatePointAroundPivot(position + new Vector3(0.1f * size, 0, 0.3f * size), position, angle); var b2 = RotatePointAroundPivot(position + new Vector3(0.1f * size, 0, 0.3f * size), position, direction);
var b3 = RotatePointAroundPivot(position + new Vector3(0, -0.1f * size, 0.3f * size), position, angle); var b3 = RotatePointAroundPivot(position + new Vector3(0, -0.1f * size, 0.3f * size), position, direction);
var b4 = RotatePointAroundPivot(position + new Vector3(-0.1f * size, 0, 0.3f * size), position, angle); var b4 = RotatePointAroundPivot(position + new Vector3(-0.1f * size, 0, 0.3f * size), position, direction);
var c1 = RotatePointAroundPivot(position + new Vector3(0, 0.2f * size, 0.3f * size), position, angle); var c1 = RotatePointAroundPivot(position + new Vector3(0, 0.2f * size, 0.3f * size), position, direction);
var c2 = RotatePointAroundPivot(position + new Vector3(0.2f * size, 0, 0.3f * size), position, angle); var c2 = RotatePointAroundPivot(position + new Vector3(0.2f * size, 0, 0.3f * size), position, direction);
var c3 = RotatePointAroundPivot(position + new Vector3(0, -0.2f * size, 0.3f * size), position, angle); var c3 = RotatePointAroundPivot(position + new Vector3(0, -0.2f * size, 0.3f * size), position, direction);
var c4 = RotatePointAroundPivot(position + new Vector3(-0.2f * size, 0, 0.3f * size), position, angle); var c4 = RotatePointAroundPivot(position + new Vector3(-0.2f * size, 0, 0.3f * size), position, direction);
var d = RotatePointAroundPivot(position + new Vector3(0, 0, 0.5f * size), position, angle); var d = RotatePointAroundPivot(position + new Vector3(0, 0, 0.5f * size), position, direction);
Gizmos.DrawLine(position, a1); Gizmos.DrawLine(position, a1);
Gizmos.DrawLine(position, a2); Gizmos.DrawLine(position, a2);
@ -102,10 +164,11 @@ namespace ABI.CCK.Components
Gizmos.DrawLine(c4, d); Gizmos.DrawLine(c4, d);
} }
private Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles) private Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 direction)
{ {
var dir = point - pivot; // get point direction relative to pivot var dir = point - pivot; // get point direction relative to pivot
dir = Quaternion.Euler(angles) * dir; // rotate it Quaternion rotation = Quaternion.LookRotation(direction, Vector3.up);
dir = rotation * dir; // rotate it
point = dir + pivot; // calculate rotated point point = dir + pivot; // calculate rotated point
return point; // return it return point; // return it
} }

View file

@ -7,46 +7,66 @@ namespace ABI.CCK.Components
[System.Serializable] [System.Serializable]
public class CVRInteractableAction public class CVRInteractableAction
{ {
#region Filtering Attribute Classes
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class AllowSpawnable : Attribute { }
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class AllowWorld : Attribute { }
#endregion
public enum ActionRegister public enum ActionRegister
{ {
OnGrab = 1, [AllowWorld, AllowSpawnable] OnGrab = 1,
OnDrop = 2, [AllowWorld, AllowSpawnable] OnDrop = 2,
OnInteractDown = 3, [AllowWorld, AllowSpawnable] OnInteractDown = 3,
OnInteractUp = 4, [AllowWorld, AllowSpawnable] OnInteractUp = 4,
OnEnterTrigger = 5, [AllowWorld] OnEnterTrigger = 5,
OnExitTrigger = 6, [AllowWorld] OnExitTrigger = 6,
OnEnterCollider = 7, [AllowWorld] OnEnterCollider = 7,
OnExitCollider = 8, [AllowWorld] OnExitCollider = 8,
OnEnable = 9, [AllowWorld] OnPlayerTriggerEnter = 29,
OnDisable = 10, [AllowWorld] OnPlayerTriggerExit = 30,
OnTimer = 11, [AllowWorld] OnPlayerColliderEnter = 31,
OnParticleHit = 12, [AllowWorld] OnPlayerColliderExit = 32,
OnVariableBufferUpdate = 13, [AllowWorld] OnEnable = 9,
OnVariableBufferComparision = 14, [AllowWorld] OnDisable = 10,
OnCron = 15, [AllowWorld] OnTimer = 11,
OnPointerEnter = 16, [AllowWorld] OnParticleHit = 12,
OnWorldTrigger = 17, [AllowWorld] OnVariableBufferUpdate = 13,
OnCustomTrigger = 18, [AllowWorld] OnVariableBufferComparision = 14,
OnInputDown = 19, [AllowWorld] OnCron = 15,
OnInputUp = 20, [AllowWorld] OnPointerEnter = 16,
OnAPFTrigger = 21, [AllowWorld] OnPointerExit = 28,
OnAPFBoolChange = 22, [AllowWorld, AllowSpawnable] OnWorldTrigger = 17,
OnAPFIntChange = 23, [AllowWorld, AllowSpawnable] OnCustomTrigger = 18,
OnAPFFloatChange = 24, [AllowWorld, AllowSpawnable] OnInputDown = 19,
OnAPFStringChange = 27, [AllowWorld, AllowSpawnable] OnInputUp = 20,
OnGazeEnter = 25, [AllowWorld] OnAPFTrigger = 21,
OnGazeExit = 26 [AllowWorld] OnAPFBoolChange = 22,
[AllowWorld] OnAPFIntChange = 23,
[AllowWorld] OnAPFFloatChange = 24,
[AllowWorld] OnAPFStringChange = 27,
[AllowWorld] OnHoverEnter = 25, // used to be OnGazeEnter
[AllowWorld] OnHoverExit = 26, // used to be OnGazeExit
[AllowWorld] OnBecameVisible = 33,
[AllowWorld] OnBecameInvisible = 34,
// must be called via StateMachineCallbackSender StateMachineBehaviour
[AllowWorld, AllowSpawnable] OnStateMachineEnter = 35,
[AllowWorld, AllowSpawnable] OnStateMachineExit = 36
} }
public enum ExecutionType public enum ExecutionType
{ {
LocalNotNetworked = 1, [AllowWorld, AllowSpawnable] LocalNotNetworked = 1,
GlobalNetworked = 2, [AllowWorld] GlobalNetworked = 2,
GlobalNetworkedBuffered = 4, [AllowWorld] GlobalNetworkedBuffered = 4,
GlobalInstanceOwnerOnly = 3, [AllowWorld] GlobalInstanceOwnerOnly = 3,
GlobalInstanceOwnerOnlyBuffered = 5, [AllowWorld] GlobalInstanceOwnerOnlyBuffered = 5,
GlobalNetworkedAllInstanceModerators = 6, [AllowWorld] GlobalNetworkedAllInstanceModerators = 6,
GlobalNetworkedAllInstanceModeratorsBuffered = 7 [AllowWorld] GlobalNetworkedAllInstanceModeratorsBuffered = 7
} }
public float delay = 0f; public float delay = 0f;
@ -54,7 +74,7 @@ namespace ABI.CCK.Components
public List<CVRInteractableActionOperation> operations = new List<CVRInteractableActionOperation>(); public List<CVRInteractableActionOperation> operations = new List<CVRInteractableActionOperation>();
public ActionRegister actionType = ActionRegister.OnInteractDown; public ActionRegister actionType = ActionRegister.OnInteractDown;
public ExecutionType execType = ExecutionType.GlobalNetworked; public ExecutionType execType = ExecutionType.LocalNotNetworked;
public LayerMask layerMask = 0; public LayerMask layerMask = 0;
@ -62,6 +82,7 @@ namespace ABI.CCK.Components
public float floatVal2 = 0; public float floatVal2 = 0;
public float floatVal3 = 0; public float floatVal3 = 0;
public bool boolVal; public bool boolVal;
public bool boolVal2;
public CVRVariableBuffer varBufferVal; public CVRVariableBuffer varBufferVal;
public CVRVariableBuffer varBufferVal2; public CVRVariableBuffer varBufferVal2;
public string stringVal = ""; public string stringVal = "";

View file

@ -1,5 +1,5 @@
using System.Collections.Generic; using System;
using UnityEditor; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
@ -8,45 +8,59 @@ namespace ABI.CCK.Components
[System.Serializable] [System.Serializable]
public class CVRInteractableActionOperation public class CVRInteractableActionOperation
{ {
#region Filtering Attribute Classes
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class AllowSpawnable : Attribute { }
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class AllowWorld : Attribute { }
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class HideFromSetPropertyByValue : Attribute { }
#endregion
public enum ActionType public enum ActionType
{ {
SetGameObjectActive = 1, [AllowWorld, AllowSpawnable] SetGameObjectActive = 1,
//SetComponentActive = 2, [AllowWorld, AllowSpawnable] SetComponentActive = 2,
SetAnimatorFloatValue = 3, [AllowWorld, AllowSpawnable] SetAnimatorFloatValue = 3,
SetAnimatorBoolValue = 4, [AllowWorld, AllowSpawnable] SetAnimatorBoolValue = 4,
SetAnimatorIntValue = 17, [AllowWorld, AllowSpawnable] SetAnimatorIntValue = 17,
TriggerAnimatorTrigger = 18, [AllowWorld, AllowSpawnable] TriggerAnimatorTrigger = 18,
SpawnObject = 5, [AllowWorld] SpawnObject = 5,
TeleportPlayer = 6, [AllowWorld, AllowSpawnable] TeleportPlayer = 6,
TeleportObject = 7, [AllowWorld, AllowSpawnable] TeleportObject = 7,
ToggleAnimatorBoolValue = 8, [AllowWorld, AllowSpawnable] ToggleAnimatorBoolValue = 8,
SetAnimatorFloatRandom = 9, [AllowWorld, AllowSpawnable] SetAnimatorFloatRandom = 9,
SetAnimatorBoolRandom = 10, [AllowWorld, AllowSpawnable] SetAnimatorBoolRandom = 10,
SetAnimatorIntRandom = 19, [AllowWorld, AllowSpawnable] SetAnimatorIntRandom = 19,
SetAnimatorFloatByVar = 11, [AllowWorld, AllowSpawnable] SetAnimatorFloatByVar = 11,
SetAnimatorIntByVar = 20, [AllowWorld, AllowSpawnable] SetAnimatorIntByVar = 20,
VariableBufferArithmetic = 12, [AllowWorld, AllowSpawnable] VariableBufferArithmetic = 12,
DisplayWorldDetailPage = 13, [AllowWorld, AllowSpawnable] DisplayWorldDetailPage = 13,
DisplayInstanceDetailPage = 14, [AllowWorld, AllowSpawnable] DisplayInstanceDetailPage = 14,
DisplayAvatarDetailPage = 15, [AllowWorld, AllowSpawnable] DisplayAvatarDetailPage = 15,
DisplaySpawnableDetailPage = 37, [AllowWorld, AllowSpawnable] DisplaySpawnableDetailPage = 37,
SitAtPosition = 16, [AllowWorld, AllowSpawnable] SitAtPosition = 16,
MethodCall = 21, [AllowWorld, AllowSpawnable] MethodCall = 21,
SetSpawnableValue = 22, [AllowWorld, AllowSpawnable] SetSpawnableValue = 22,
PlayAudio = 23, [AllowWorld, AllowSpawnable] PlayAudio = 23,
StopAudio = 24, [AllowWorld, AllowSpawnable] StopAudio = 24,
SetAnimatorBoolByAPF= 25, [AllowWorld, AllowSpawnable] SetAnimatorBoolByAPF = 25,
SetAnimatorIntByAPF = 26, [AllowWorld, AllowSpawnable] SetAnimatorIntByAPF = 26,
SetAnimatorFloatByAPF = 27, [AllowWorld, AllowSpawnable] SetAnimatorFloatByAPF = 27,
SetVariableBufferByAPF= 28, [AllowWorld, AllowSpawnable] SetVariableBufferByAPF= 28,
UpdateAPFTrigger = 29, [AllowWorld, AllowSpawnable] UpdateAPFTrigger = 29,
UpdateAPFBool = 30, [AllowWorld, AllowSpawnable] UpdateAPFBool = 30,
UpdateAPFInt = 31, [AllowWorld, AllowSpawnable] UpdateAPFInt = 31,
UpdateAPFFloat = 32, [AllowWorld, AllowSpawnable] UpdateAPFFloat = 32,
UpdateAPFString = 33, [AllowWorld, AllowSpawnable] UpdateAPFString = 33,
SetPropertyByApf = 34, [AllowWorld, AllowSpawnable] SetPropertyByApf = 34,
SetPropertyByValue = 35, [AllowWorld, AllowSpawnable] SetPropertyByValue = 35,
DeleteGameObject = 36, [AllowWorld, AllowSpawnable] DeleteGameObject = 36,
[AllowWorld, AllowSpawnable] LuaFunctionCall = 38,
} }
public ActionType type = ActionType.SetGameObjectActive; public ActionType type = ActionType.SetGameObjectActive;

View file

@ -0,0 +1,11 @@
using UnityEngine;
namespace ABI.CCK.Components
{
/// <summary>
/// This is a Lua script that runs entirely on your side of the connection (client-side).
/// </summary>
public class CVRLuaClientBehaviour : CVRBaseLuaBehaviour
{
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 70e2beb286f4c1b4690755891d0604a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -3,7 +3,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRMaterialDriver : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Material Driver")]
[HelpURL("https://developers.abinteractive.net/cck/components/material-driver/")]
public class CVRMaterialDriver : MonoBehaviour, ICCK_Component
{ {
public float material01X; public float material01X;
public float material01Y; public float material01Y;

View file

@ -1,9 +1,10 @@
using System; using UnityEngine;
using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRMaterialUpdater : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Material Updater")]
[HelpURL("https://developers.abinteractive.net/cck/components/material-updater/")]
public class CVRMaterialUpdater : MonoBehaviour, ICCK_Component
{ {
public enum UpdateType public enum UpdateType
{ {
@ -13,39 +14,42 @@ namespace ABI.CCK.Components
public UpdateType updateType = UpdateType.Update; public UpdateType updateType = UpdateType.Update;
private Renderer renderer; private Renderer render;
private Vector3 lastPos; private Vector3 lastPos;
private Vector3 velocity; private Vector3 velocity;
private Vector3 lastRot; private Vector3 lastRot;
private Vector3 angularVelocity; private Vector3 angularVelocity;
private static readonly int _cvrVelocity = Shader.PropertyToID("_CVR_Velocity");
private static readonly int _cvrAngularVelocity = Shader.PropertyToID("_CVR_Angular_Velocity");
private void Start() private void Start()
{ {
renderer = GetComponent<Renderer>(); render = GetComponent<Renderer>();
} }
private void Update() private void Update()
{ {
if (updateType == UpdateType.FixedUpdate || renderer == null) return; if (updateType == UpdateType.FixedUpdate || render == null) return;
ProcessUpdate(); ProcessUpdate();
} }
private void FixedUpdate() private void FixedUpdate()
{ {
if (updateType == UpdateType.Update || renderer == null) return; if (updateType == UpdateType.Update || render == null) return;
ProcessUpdate(); ProcessUpdate();
} }
private void ProcessUpdate() private void ProcessUpdate()
{ {
velocity = (lastPos - transform.position) / (updateType == UpdateType.Update?Time.deltaTime:Time.fixedDeltaTime); velocity = (lastPos - transform.position) / (updateType == UpdateType.Update?Time.deltaTime:Time.fixedDeltaTime);
angularVelocity = transform.rotation.eulerAngles - lastRot; Quaternion rotation = transform.rotation;
angularVelocity = rotation.eulerAngles - lastRot;
renderer.material.SetVector("_CVR_Velocity", velocity); render.material.SetVector(_cvrVelocity, velocity);
renderer.material.SetVector("_CVR_Angular_Velocity", angularVelocity); render.material.SetVector(_cvrAngularVelocity, angularVelocity);
lastPos = transform.position; lastPos = transform.position;
lastRot = transform.rotation.eulerAngles; lastRot = rotation.eulerAngles;
} }
} }
} }

View file

@ -1,25 +1,384 @@
using UnityEngine; using System;
using System.Collections; using ABI.CCK.Components;
using System.Collections.Generic; using UnityEngine;
#pragma warning disable // https://web.archive.org/web/20210507003436/http://wiki.unity3d.com/index.php/MirrorReflection4
public class CVRMirror : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Mirror")]
[HelpURL("https://developers.abinteractive.net/cck/components/mirror/")]
[ExecuteInEditMode]
public class CVRMirror : MonoBehaviour, ICCK_Component
{ {
public bool m_DisablePixelLights = true; public enum MirrorClearFlags {Skybox = 1, Color = 2}
public int m_TextureSize = 256;
public float m_ClipPlaneOffset = 0.07f;
public int m_framesNeededToUpdate = 0;
// General
public bool m_DisablePixelLights = true;
public int m_TextureSize = 4096;
public LayerMask m_ReflectLayers = -1; public LayerMask m_ReflectLayers = -1;
private Dictionary<Camera, Camera> m_ReflectionCameras = new Dictionary<Camera, Camera>(); // Optimization
public bool m_UseOcclusionCulling;
private RenderTexture m_ReflectionTextureLeft = null; // Advanced
private RenderTexture m_ReflectionTextureRight = null; public MirrorClearFlags m_ClearFlags = MirrorClearFlags.Skybox;
private int m_OldReflectionTextureSize = 0; public Material m_CustomSkybox;
public Color m_CustomColor = new Color(19, 30, 47);
private int m_frameCounter = 0; // Advanced / Why ??
public float m_ClipPlaneOffset = 0.001f;
public int m_framesNeededToUpdate;
private static bool s_InsideRendering = false; // Legacy behaviour forces player layers on + UI off
public bool m_ignoreLegacyBehaviour;
private Camera m_ReflectionCamera;
private RenderTexture m_ReflectionTextureLeft;
private RenderTexture m_ReflectionTextureRight;
private MaterialPropertyBlock m_PropertyBlock;
private Renderer m_MirrorRenderer;
private int m_frameCounter;
private static bool s_InsideRendering;
// mirror mesh normal in local coordinates
private Vector3 mirrorNormal = Vector3.zero;
// configurable by player in-game
private int usedTextureSize = 4096;
private int usedMsaa = 0;
private static Shader mirrorShader;
private static readonly int _propertyLeft = Shader.PropertyToID("_ReflectionTexLeft");
private static readonly int _propertyRight = Shader.PropertyToID("_ReflectionTexRight");
#if UNITY_EDITOR
private void Reset()
{
// Ensure new content is not "legacy".
m_ignoreLegacyBehaviour = true;
}
public void OnValidate()
{
// prevent against infinite reimport when viewing prefabs
if (!gameObject.scene.IsValid())
return;
CleanupMirrorObjects();
m_MirrorRenderer = GetComponent<Renderer>();
if (!m_MirrorRenderer)
{
enabled = false;
return;
}
if (mirrorShader == null)
mirrorShader = Shader.Find("FX/MirrorReflection");
m_PropertyBlock ??= new MaterialPropertyBlock();
var materials = m_MirrorRenderer.sharedMaterials;
foreach (Material mat in materials)
{
if (mat == null) continue;
if (mat.shader.name is "FX/MirrorReflection" or "Alpha Blend Interactive/MirrorReflection")
mat.shader = mirrorShader;
}
m_MirrorRenderer.sharedMaterials = materials;
}
#endif
private void Start()
{
LegacyBehaviourIfNeeded();
// Prevent mirrors from reflecting others
// This is a reserved layer, no prior content should be using it
gameObject.layer = 14;
m_ReflectLayers &= ~(1 << 14);
mirrorShader = Shader.Find("FX/MirrorReflection");
m_PropertyBlock ??= new MaterialPropertyBlock();
m_MirrorRenderer = GetComponent<Renderer>();
if (!m_MirrorRenderer)
{
enabled = false;
return;
}
var materials = m_MirrorRenderer.sharedMaterials;
foreach (Material mat in materials)
{
if (mat == null) continue;
if (mat.shader.name is "FX/MirrorReflection" or "Alpha Blend Interactive/MirrorReflection")
mat.shader = mirrorShader;
}
m_MirrorRenderer.sharedMaterials = materials;
}
private void OnDisable()
{
CleanupMirrorObjects();
}
private void OnDestroy()
{
if (m_ReflectionCamera == null)
return;
if (Application.isEditor)
DestroyImmediate(m_ReflectionCamera.gameObject);
else
Destroy(m_ReflectionCamera.gameObject);
}
private void LegacyBehaviourIfNeeded()
{
if (m_ignoreLegacyBehaviour)
return;
// Older worlds should still force player-layers on for compatability.
// CCK Mirror prefab didn't reflect local player, so user content only worked cause of this!
m_UseOcclusionCulling = false;
m_ClipPlaneOffset = 0.001f; // exposed in CCK
m_ReflectLayers &= ~(1 << 5);
m_ReflectLayers &= ~(1 << 15);
m_ReflectLayers |= 1 << 8;
m_ReflectLayers |= 1 << 9;
m_ReflectLayers |= 1 << 10;
}
// This is called when it's known that the object will be rendered by some
// camera. We render reflections and do other updates here.
// Because the script executes in edit mode, reflections for the scene view
// camera will just work!
public void OnWillRenderObject()
{
if (!enabled || !m_MirrorRenderer || !m_MirrorRenderer.sharedMaterial || !m_MirrorRenderer.enabled)
return;
// Previously was RootLogic.Instance.activeCamera;
// Camera.current produces correct reflection with *any* camera, be it photo camera, in-world camera, camera on an avatar, or anything else
// TODO: consider a marker or settings component (i.e. CVRCameraSettings) that would allow excluding mirrors from camera render (useful on both avatars and worlds)
Camera cam = Camera.current;
if (!cam)
return;
// Safeguard from recursive reflections.
if (s_InsideRendering) return;
s_InsideRendering = true;
if (m_frameCounter > 0)
{
m_frameCounter--;
return;
}
m_frameCounter = m_framesNeededToUpdate;
mirrorNormal = Vector3.up;
MeshFilter meshFilter = GetComponent<MeshFilter>();
Mesh mesh = meshFilter != null ? meshFilter.sharedMesh : null;
if (mesh != null && mesh.normals.Length > 0)
mirrorNormal = mesh.normals[0];
// Optionally disable pixel lights for reflection
int oldPixelLightCount = QualitySettings.pixelLightCount;
if (m_DisablePixelLights)
QualitySettings.pixelLightCount = 0;
try
{
RenderCamera(cam, m_MirrorRenderer, Camera.StereoscopicEye.Left, ref m_ReflectionTextureLeft);
m_PropertyBlock.SetTexture(_propertyLeft, m_ReflectionTextureLeft);
if (!cam.stereoEnabled) return;
RenderCamera(cam, m_MirrorRenderer, Camera.StereoscopicEye.Right, ref m_ReflectionTextureRight);
m_PropertyBlock.SetTexture(_propertyRight, m_ReflectionTextureRight);
}
finally
{
s_InsideRendering = false;
m_MirrorRenderer.SetPropertyBlock(m_PropertyBlock);
if (m_DisablePixelLights) // Restore pixel light count
QualitySettings.pixelLightCount = oldPixelLightCount;
}
}
private void RenderCamera(Camera cam, Renderer rend, Camera.StereoscopicEye eye,
ref RenderTexture reflectionTexture)
{
// find out the reflection plane: position and normal in world space
Vector3 pos = transform.position;
Vector3 normal = transform.TransformDirection(mirrorNormal);
CreateMirrorObjects(cam, eye, ref reflectionTexture);
CopyCameraProperties(cam, m_ReflectionCamera);
m_ReflectionCamera.useOcclusionCulling = m_UseOcclusionCulling;
m_ReflectionCamera.depthTextureMode = cam.depthTextureMode | DepthTextureMode.Depth;
m_ReflectionCamera.stereoTargetEye = StereoTargetEyeMask.None;
m_ReflectionCamera.cullingMask = m_ReflectLayers.value;
// Render reflection
// Reflect camera around reflection plane
float d = -Vector3.Dot(normal, pos) - m_ClipPlaneOffset;
Vector4 reflectionPlane = new Vector4(normal.x, normal.y, normal.z, d);
Matrix4x4 reflection = Matrix4x4.zero;
CalculateReflectionMatrix(ref reflection, reflectionPlane);
Matrix4x4 worldToCameraMatrix;
if (cam.stereoEnabled)
worldToCameraMatrix = cam.GetStereoViewMatrix(eye) * reflection;
else
worldToCameraMatrix = cam.worldToCameraMatrix * reflection;
m_ReflectionCamera.targetTexture = reflectionTexture;
Matrix4x4 cameraSideReflection = Matrix4x4.zero;
CalculateReflectionMatrix(ref cameraSideReflection, new Vector4(1, 0, 0, 0));
worldToCameraMatrix = cameraSideReflection * worldToCameraMatrix;
m_ReflectionCamera.worldToCameraMatrix = worldToCameraMatrix;
// Setup oblique projection matrix so that near plane is our reflection
// plane. This way we clip everything below/above it for free.
Vector4 clipPlane = CameraSpacePlane(worldToCameraMatrix, pos, normal, 1.0f);
m_ReflectionCamera.projectionMatrix = cameraSideReflection *
(cam.stereoEnabled
? cam.GetStereoProjectionMatrix(eye)
: cam.projectionMatrix) * cameraSideReflection.inverse;
m_ReflectionCamera.projectionMatrix = m_ReflectionCamera.CalculateObliqueMatrix(clipPlane);
m_ReflectionCamera.Render();
}
// Cleanup all the objects we possibly have created
private void CleanupMirrorObjects()
{
if (m_ReflectionTextureLeft)
{
RenderTexture.ReleaseTemporary(m_ReflectionTextureLeft);
m_ReflectionTextureLeft = null;
}
if (m_ReflectionTextureRight)
{
RenderTexture.ReleaseTemporary(m_ReflectionTextureRight);
m_ReflectionTextureRight = null;
}
}
private void CopyCameraProperties(Camera src, Camera dest)
{
if (dest == null)
return;
dest.CopyFrom(src);
if (m_ClearFlags == MirrorClearFlags.Skybox)
{
dest.clearFlags = CameraClearFlags.Skybox;
Skybox mysky = dest.GetComponent<Skybox>();
if (!mysky || !m_CustomSkybox)
{
mysky.enabled = false;
}
else
{
mysky.enabled = true;
mysky.material = m_CustomSkybox;
}
}
else if (m_ClearFlags == MirrorClearFlags.Color)
{
dest.clearFlags = CameraClearFlags.Color;
dest.backgroundColor = m_CustomColor;
}
}
private void CreateMirrorObjects(Camera currentCamera, Camera.StereoscopicEye eye,
ref RenderTexture reflectionTexture)
{
// Calculate target resolution
int currentTextureWidth = Mathf.RoundToInt(Math.Min(usedTextureSize, currentCamera.pixelWidth));
int currentTextureHeight = Mathf.RoundToInt(Math.Min(usedTextureSize, currentCamera.pixelHeight));
var targetMsaa = usedMsaa;
if (targetMsaa == 0)
{
RenderTexture targetTexture = currentCamera.targetTexture;
if (targetTexture != null)
targetMsaa = targetTexture.antiAliasing;
else
targetMsaa = QualitySettings.antiAliasing == 0 ? 1 : QualitySettings.antiAliasing;
}
// Unity is good at caching rendertextures, so releasing it here and then immediately re-allocating a texture with the same resolution is fast
// If the resolution is different, a new texture will be allocated and the old one will be freed
if (reflectionTexture)
RenderTexture.ReleaseTemporary(reflectionTexture);
// Additionally, releasing it here (instead of after mirror rendering is done) allows it to survive turning away from the mirror,
// so that turning away from and back towards a mirror does not lead to lag spikes
// Reflection render texture
reflectionTexture = RenderTexture.GetTemporary(currentTextureWidth, currentTextureHeight, 24,
RenderTextureFormat.ARGBHalf,
RenderTextureReadWrite.Default, targetMsaa, RenderTextureMemoryless.None, VRTextureUsage.None);
reflectionTexture.name = "__MirrorReflection" + eye.ToString() + GetInstanceID();
// Camera for reflection
if (m_ReflectionCamera == null)
{
GameObject go = new GameObject("Mirror Reflection Camera id" + GetInstanceID(),
typeof(Camera), typeof(Skybox), typeof(FlareLayer));
// Parent it to the mirror for easy cleanup in case of destroyed mirror
go.transform.SetParent(transform);
m_ReflectionCamera = go.GetComponent<Camera>();
// Reflection camera transform is irrelevant because it has matrices set explicitly
m_ReflectionCamera.enabled = false;
go.hideFlags = HideFlags.DontSave | HideFlags.HideInHierarchy;
}
}
// Given position/normal of the plane, calculates plane in camera space.
private Vector4 CameraSpacePlane(Matrix4x4 worldToCameraMatrix, Vector3 pos, Vector3 normal, float sideSign)
{
Vector3 offsetPos = pos + normal * m_ClipPlaneOffset;
Vector3 cpos = worldToCameraMatrix.MultiplyPoint(offsetPos);
Vector3 cnormal = worldToCameraMatrix.MultiplyVector(normal).normalized * sideSign;
return new Vector4(cnormal.x, cnormal.y, cnormal.z, -Vector3.Dot(cpos, cnormal));
}
// Calculates reflection matrix around the given plane
private static void CalculateReflectionMatrix(ref Matrix4x4 reflectionMat, Vector4 plane)
{
reflectionMat.m00 = (1F - 2F * plane[0] * plane[0]);
reflectionMat.m01 = (-2F * plane[0] * plane[1]);
reflectionMat.m02 = (-2F * plane[0] * plane[2]);
reflectionMat.m03 = (-2F * plane[3] * plane[0]);
reflectionMat.m10 = (-2F * plane[1] * plane[0]);
reflectionMat.m11 = (1F - 2F * plane[1] * plane[1]);
reflectionMat.m12 = (-2F * plane[1] * plane[2]);
reflectionMat.m13 = (-2F * plane[3] * plane[1]);
reflectionMat.m20 = (-2F * plane[2] * plane[0]);
reflectionMat.m21 = (-2F * plane[2] * plane[1]);
reflectionMat.m22 = (1F - 2F * plane[2] * plane[2]);
reflectionMat.m23 = (-2F * plane[3] * plane[2]);
reflectionMat.m30 = 0F;
reflectionMat.m31 = 0F;
reflectionMat.m32 = 0F;
reflectionMat.m33 = 1F;
}
} }

View file

@ -3,8 +3,30 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRMovementParent : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Movement Parent")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRMovementParent : MonoBehaviour, ICCK_Component
{ {
public enum VelocityInheritanceMode
{
None = 0,
Parent = 1,
Reference = 2
}
public enum OrientationMode
{
Disabled = 0,
RotateWithParent = 1
}
[Tooltip("Controls whether the player should rotate with the moving platform.")]
public OrientationMode orientationMode = OrientationMode.RotateWithParent;
[Tooltip("Controls how the player inherits velocity from the moving platform.")]
public VelocityInheritanceMode velocityInheritance = VelocityInheritanceMode.Reference;
// to make the enabled checkbox display
private void OnEnable(){}
} }
} }

View file

@ -3,7 +3,9 @@ using UnityEngine.AI;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRNavController : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Nav Controller")]
[HelpURL("https://developers.abinteractive.net/cck/components/nav-controller/")]
public class CVRNavController : MonoBehaviour, ICCK_Component
{ {
public NavMeshAgent navMeshAgent; public NavMeshAgent navMeshAgent;
public Transform[] navTargetList; public Transform[] navTargetList;

View file

@ -3,7 +3,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRObjectLibrary : MonoBehaviour [AddComponentMenu("")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRObjectLibrary : MonoBehaviour, ICCK_Component
{ {
public List<CVRObjectCatalogCategory> objectCatalogCategories = new List<CVRObjectCatalogCategory>(); public List<CVRObjectCatalogCategory> objectCatalogCategories = new List<CVRObjectCatalogCategory>();
public List<CVRObjectCatalogEntry> objectCatalogEntries = new List<CVRObjectCatalogEntry>(); public List<CVRObjectCatalogEntry> objectCatalogEntries = new List<CVRObjectCatalogEntry>();

View file

@ -3,7 +3,9 @@ using UnityEngine;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRObjectSync : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Object Sync")]
[HelpURL("https://developers.abinteractive.net/cck/components/object-sync/")]
public class CVRObjectSync : MonoBehaviour, ICCK_Component
{ {
[HideInInspector] [HideInInspector]

View file

@ -18,9 +18,9 @@ namespace ABI.CCK.Components
public TaskType type = TaskType.Position; public TaskType type = TaskType.Position;
public Component component = null; public Component component;
public int intVal = 0; public int intVal;
public CVRSerializableObjectSyncTask getDefaultValues() public CVRSerializableObjectSyncTask getDefaultValues()
{ {
@ -34,28 +34,24 @@ namespace ABI.CCK.Components
retPos.value = ((Transform) component).position.ToString("F6"); retPos.value = ((Transform) component).position.ToString("F6");
retPos.intVal = intVal; retPos.intVal = intVal;
return retPos; return retPos;
break;
case TaskType.Rotation: case TaskType.Rotation:
var retRot = new CVRSerializableObjectSyncTask(); var retRot = new CVRSerializableObjectSyncTask();
retRot.type = TaskType.Rotation; retRot.type = TaskType.Rotation;
retRot.value = ((Transform) component).eulerAngles.ToString("F3"); retRot.value = ((Transform) component).eulerAngles.ToString("F3");
retRot.intVal = intVal; retRot.intVal = intVal;
return retRot; return retRot;
break;
case TaskType.ActivityState: case TaskType.ActivityState:
var retAct = new CVRSerializableObjectSyncTask(); var retAct = new CVRSerializableObjectSyncTask();
retAct.type = TaskType.ActivityState; retAct.type = TaskType.ActivityState;
retAct.value = ((Transform) component).gameObject.activeSelf ? "1" : "0"; retAct.value = ((Transform) component).gameObject.activeSelf ? "1" : "0";
retAct.intVal = intVal; retAct.intVal = intVal;
return retAct; return retAct;
break;
case TaskType.PickupOwner: case TaskType.PickupOwner:
var retPick = new CVRSerializableObjectSyncTask(); var retPick = new CVRSerializableObjectSyncTask();
retPick.type = TaskType.PickupOwner; retPick.type = TaskType.PickupOwner;
retPick.value = ""; retPick.value = "";
retPick.intVal = intVal; retPick.intVal = intVal;
return retPick; return retPick;
break;
case TaskType.AnimatorParameter: case TaskType.AnimatorParameter:
var retAniParam = new CVRSerializableObjectSyncTask(); var retAniParam = new CVRSerializableObjectSyncTask();
retAniParam.type = TaskType.AnimatorParameter; retAniParam.type = TaskType.AnimatorParameter;
@ -80,21 +76,18 @@ namespace ABI.CCK.Components
} }
retAniParam.intVal = intVal; retAniParam.intVal = intVal;
return retAniParam; return retAniParam;
break;
case TaskType.AnimatorAnimationProgress: case TaskType.AnimatorAnimationProgress:
var retAniProg = new CVRSerializableObjectSyncTask(); var retAniProg = new CVRSerializableObjectSyncTask();
retAniProg.type = TaskType.AnimatorAnimationProgress; retAniProg.type = TaskType.AnimatorAnimationProgress;
retAniProg.value = (0f).ToString("F8"); retAniProg.value = (0f).ToString("F8");
retAniProg.intVal = intVal; retAniProg.intVal = intVal;
return retAniProg; return retAniProg;
break;
case TaskType.VariableBufferValue: case TaskType.VariableBufferValue:
var retVar = new CVRSerializableObjectSyncTask(); var retVar = new CVRSerializableObjectSyncTask();
retVar.type = TaskType.VariableBufferValue; retVar.type = TaskType.VariableBufferValue;
retVar.value = ((CVRVariableBuffer) component).defaultValue.ToString("F8"); retVar.value = ((CVRVariableBuffer) component).defaultValue.ToString("F8");
retVar.intVal = intVal; retVar.intVal = intVal;
return retVar; return retVar;
break;
} }
return null; return null;

View file

@ -1,9 +1,13 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Animations;
namespace ABI.CCK.Components namespace ABI.CCK.Components
{ {
public class CVRParameterStream : MonoBehaviour [AddComponentMenu("ChilloutVR/CVR Parameter Stream")]
[HelpURL("https://developers.abinteractive.net/cck/")]
public class CVRParameterStream : MonoBehaviour, ICCK_Component
{ {
public enum ReferenceType public enum ReferenceType
{ {
@ -12,12 +16,24 @@ namespace ABI.CCK.Components
Spawnable = 2 Spawnable = 2
} }
[NotKeyable]
public ReferenceType referenceType = ReferenceType.World; public ReferenceType referenceType = ReferenceType.World;
public List<CVRParameterStreamEntry> entries = new List<CVRParameterStreamEntry>(); public List<CVRParameterStreamEntry> entries = new();
public bool onlyUpdateWhenHeld;
public bool onlyUpdateWhenAttached;
public bool onlyUpdateWhenControlled;
private void OnEnable()
{
// ignored, required to make the enabled checkbox display
}
} }
[System.Serializable] #region CVRParameterStreamEntry Class
[Serializable]
public class CVRParameterStreamEntry public class CVRParameterStreamEntry
{ {
public enum Type public enum Type
@ -47,14 +63,46 @@ namespace ABI.CCK.Components
LocalPlayerHudEnabled = 220, LocalPlayerHudEnabled = 220,
LocalPlayerNameplatesEnabled = 230, LocalPlayerNameplatesEnabled = 230,
LocalPlayerHeight = 240, LocalPlayerHeight = 240,
LocalPlayerControllerType = 250, LocalPlayerLeftControllerType = 250,
LocalPlayerRightControllerType = 251,
LocalPlayerFullBodyEnabled = 260, LocalPlayerFullBodyEnabled = 260,
TriggerLeftValue = 270, TriggerLeftValue = 270,
TriggerRightValue = 280, TriggerRightValue = 280,
GripLeftValue = 290, GripLeftValue = 290,
GripRightValue = 300, GripRightValue = 300,
GrippedObjectLeft = 310, GrippedObjectLeft = 310,
GrippedObjectRight = 320 GrippedObjectRight = 320,
AvatarHeight = 400,
AvatarUpright = 401,
TransformGlobalPositionX = 500,
TransformGlobalPositionY = 501,
TransformGlobalPositionZ = 502,
TransformGlobalRotationX = 510,
TransformGlobalRotationY = 511,
TransformGlobalRotationZ = 512,
TransformLocalPositionX = 520,
TransformLocalPositionY = 521,
TransformLocalPositionZ = 522,
TransformLocalRotationX = 530,
TransformLocalRotationY = 531,
TransformLocalRotationZ = 532,
FluidVolumeSubmerged = 600,
FluidVolumeDepth = 601,
FluidVolumeTimeSinceEntered = 602,
FluidVolumeTimeSinceExit = 603,
InputCarSteering = 1000,
InputCarAccelerate = 1001,
InputCarBrake = 1002,
InputCarHandbrake = 1003,
InputCarBoost = 1004,
InputMovementX = 1100,
InputMovementY = 1101,
InputLookX = 1110,
InputLookY = 1111,
InputJump = 1120,
SeedOwner = 90000,
SeedInstance = 90001,
} }
public Type type = Type.TimeSeconds; public Type type = Type.TimeSeconds;
@ -64,7 +112,7 @@ namespace ABI.CCK.Components
Animator = 0, Animator = 0,
VariableBuffer = 1, VariableBuffer = 1,
AvatarAnimator = 2, AvatarAnimator = 2,
CustomFloat = 3, CustomFloat = 3
} }
public TargetType targetType = TargetType.Animator; public TargetType targetType = TargetType.Animator;
@ -86,7 +134,7 @@ namespace ABI.CCK.Components
CompareMoreThenEquals = 121, CompareMoreThenEquals = 121,
CompareMoreThen = 131, CompareMoreThen = 131,
Mod = 141, Mod = 141,
Pow = 151, Pow = 151
} }
public ApplicationType applicationType = ApplicationType.Override; public ApplicationType applicationType = ApplicationType.Override;
@ -97,4 +145,6 @@ namespace ABI.CCK.Components
public string parameterName; public string parameterName;
} }
#endregion
} }

Some files were not shown because too many files have changed in this diff Show more