mirror of
https://github.com/nothke/quality-control.git
synced 2025-08-09 23:23:44 +00:00
Added KCC
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1cc217451b989d4db08290832cb9dc0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,76 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: White
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 4, y: 4}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 4, y: 4}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 0.5
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.661
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf774b4c734b1d04e9fbf6d71e964591
|
||||
timeCreated: 1493180259
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 974715e4a94547d4189e0801712b2685
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,127 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1937979026721672
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4353896453404184}
|
||||
- component: {fileID: 20127477809793788}
|
||||
- component: {fileID: 124551908420297706}
|
||||
- component: {fileID: 81410469953920030}
|
||||
- component: {fileID: 114014416615829144}
|
||||
m_Layer: 0
|
||||
m_Name: ExampleCamera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4353896453404184
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1937979026721672}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -5}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!20 &20127477809793788
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1937979026721672}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_GateFitMode: 2
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 75
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!124 &124551908420297706
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1937979026721672}
|
||||
m_Enabled: 1
|
||||
--- !u!81 &81410469953920030
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1937979026721672}
|
||||
m_Enabled: 1
|
||||
--- !u!114 &114014416615829144
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1937979026721672}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 24092a40b02616e479baeb940325e339, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Camera: {fileID: 20127477809793788}
|
||||
FollowPointFraming: {x: 0, y: 0}
|
||||
FollowingSharpness: 10000
|
||||
DefaultDistance: 6
|
||||
MinDistance: 0
|
||||
MaxDistance: 10
|
||||
DistanceMovementSpeed: 5
|
||||
DistanceMovementSharpness: 10
|
||||
InvertX: 0
|
||||
InvertY: 0
|
||||
DefaultVerticalAngle: 20
|
||||
MinVerticalAngle: -90
|
||||
MaxVerticalAngle: 90
|
||||
RotationSpeed: 1.3
|
||||
RotationSharpness: 10000
|
||||
ObstructionCheckRadius: 0.2
|
||||
ObstructionLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294965759
|
||||
ObstructionSharpness: 10000
|
||||
IgnoredColliders: []
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c75e91cf060bbf04e89204fa400606df
|
||||
timeCreated: 1499181144
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,394 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &43330285
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 43330286}
|
||||
m_Layer: 0
|
||||
m_Name: Root
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &43330286
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 43330285}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4036232530805280}
|
||||
- {fileID: 4718917724592500}
|
||||
m_Father: {fileID: 4898694727102280}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1072008595159340
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4036232530805280}
|
||||
m_Layer: 0
|
||||
m_Name: Meshes
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4036232530805280
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1072008595159340}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4903610365175460}
|
||||
m_Father: {fileID: 43330286}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1339159333115884
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4903610365175460}
|
||||
- component: {fileID: 33711778101729860}
|
||||
- component: {fileID: 23310449951372792}
|
||||
m_Layer: 0
|
||||
m_Name: Capsule
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4903610365175460
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1339159333115884}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4485742127011420}
|
||||
m_Father: {fileID: 4036232530805280}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &33711778101729860
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1339159333115884}
|
||||
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &23310449951372792
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1339159333115884}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 4294967295
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: cf774b4c734b1d04e9fbf6d71e964591, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 1
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!1 &1398904762131290
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4898694727102280}
|
||||
- component: {fileID: 136457490459165436}
|
||||
- component: {fileID: 114565867274256808}
|
||||
- component: {fileID: 114967586934651944}
|
||||
- component: {fileID: 6177337246575538918}
|
||||
m_Layer: 0
|
||||
m_Name: ExampleCharacter
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4898694727102280
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1398904762131290}
|
||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.70710677}
|
||||
m_LocalPosition: {x: -40.14, y: 0, z: -29.24}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 43330286}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 90.00001, z: 0}
|
||||
--- !u!136 &136457490459165436
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 8
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1398904762131290}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 1, z: 0}
|
||||
--- !u!114 &114565867274256808
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1398904762131290}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76020eee813ed7844bcea94c5d5ce76a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Motor: {fileID: 114967586934651944}
|
||||
MaxStableMoveSpeed: 10
|
||||
StableMovementSharpness: 15
|
||||
OrientationSharpness: 10
|
||||
OrientationMethod: 1
|
||||
MaxAirMoveSpeed: 15
|
||||
AirAccelerationSpeed: 18
|
||||
Drag: 0.1
|
||||
AllowJumpingWhenSliding: 0
|
||||
JumpUpSpeed: 10
|
||||
JumpScalableForwardSpeed: 10
|
||||
JumpPreGroundingGraceTime: 0
|
||||
JumpPostGroundingGraceTime: 0
|
||||
IgnoredColliders:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
BonusOrientationMethod: 0
|
||||
BonusOrientationSharpness: 10
|
||||
Gravity: {x: 0, y: -30, z: 0}
|
||||
MeshRoot: {fileID: 4036232530805280}
|
||||
CameraFollowPoint: {fileID: 4718917724592500}
|
||||
--- !u!114 &114967586934651944
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1398904762131290}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4d1bc5515e3ab954e80599c538834774, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Capsule: {fileID: 136457490459165436}
|
||||
CapsuleRadius: 0.5
|
||||
CapsuleHeight: 2
|
||||
CapsuleYOffset: 1
|
||||
CapsulePhysicsMaterial: {fileID: 0}
|
||||
GroundDetectionExtraDistance: 0
|
||||
MaxStableSlopeAngle: 60
|
||||
StableGroundLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
DiscreteCollisionEvents: 0
|
||||
StepHandling: 1
|
||||
MaxStepHeight: 0.5
|
||||
AllowSteppingWithoutStableGrounding: 0
|
||||
MinRequiredStepDepth: 0.1
|
||||
LedgeAndDenivelationHandling: 1
|
||||
MaxStableDistanceFromLedge: 0.5
|
||||
MaxVelocityForLedgeSnap: 0
|
||||
MaxStableDenivelationAngle: 180
|
||||
InteractiveRigidbodyHandling: 1
|
||||
RigidbodyInteractionType: 0
|
||||
SimulatedCharacterMass: 1
|
||||
PreserveAttachedRigidbodyMomentum: 1
|
||||
HasPlanarConstraint: 0
|
||||
PlanarConstraintAxis: {x: 0, y: 0, z: 1}
|
||||
MaxMovementIterations: 5
|
||||
MaxDecollisionIterations: 1
|
||||
CheckMovementInitialOverlaps: 1
|
||||
KillVelocityWhenExceedMaxMovementIterations: 1
|
||||
KillRemainingMovementWhenExceedMaxMovementIterations: 1
|
||||
--- !u!54 &6177337246575538918
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1398904762131290}
|
||||
serializedVersion: 2
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 1
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
--- !u!1 &1758411822872852
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4485742127011420}
|
||||
- component: {fileID: 33111717300596878}
|
||||
- component: {fileID: 23624829931232870}
|
||||
m_Layer: 0
|
||||
m_Name: Cylinder
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4485742127011420
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1758411822872852}
|
||||
m_LocalRotation: {x: 0.70710677, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0.44099998, z: 0.18199922}
|
||||
m_LocalScale: {x: 0.88040376, y: 0.34093377, z: 0.51656276}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4903610365175460}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 90.00001, y: 0, z: 0}
|
||||
--- !u!33 &33111717300596878
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1758411822872852}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &23624829931232870
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1758411822872852}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 4294967295
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: cf774b4c734b1d04e9fbf6d71e964591, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 1
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!1 &1854746833484672
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4718917724592500}
|
||||
m_Layer: 0
|
||||
m_Name: CameraTarget
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4718917724592500
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1854746833484672}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1.43, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 43330286}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d295472d4ce25404e9aed2627c34801f
|
||||
timeCreated: 1499181148
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9751300dc66704b4f87d358c2a60f913
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace KinematicCharacterController.Examples
|
||||
{
|
||||
public class ExampleCharacterCamera : MonoBehaviour
|
||||
{
|
||||
[Header("Framing")]
|
||||
public Camera Camera;
|
||||
public Vector2 FollowPointFraming = new Vector2(0f, 0f);
|
||||
public float FollowingSharpness = 10000f;
|
||||
|
||||
[Header("Distance")]
|
||||
public float DefaultDistance = 6f;
|
||||
public float MinDistance = 0f;
|
||||
public float MaxDistance = 10f;
|
||||
public float DistanceMovementSpeed = 5f;
|
||||
public float DistanceMovementSharpness = 10f;
|
||||
|
||||
[Header("Rotation")]
|
||||
public bool InvertX = false;
|
||||
public bool InvertY = false;
|
||||
[Range(-90f, 90f)]
|
||||
public float DefaultVerticalAngle = 20f;
|
||||
[Range(-90f, 90f)]
|
||||
public float MinVerticalAngle = -90f;
|
||||
[Range(-90f, 90f)]
|
||||
public float MaxVerticalAngle = 90f;
|
||||
public float RotationSpeed = 1f;
|
||||
public float RotationSharpness = 10000f;
|
||||
public bool RotateWithPhysicsMover = false;
|
||||
|
||||
[Header("Obstruction")]
|
||||
public float ObstructionCheckRadius = 0.2f;
|
||||
public LayerMask ObstructionLayers = -1;
|
||||
public float ObstructionSharpness = 10000f;
|
||||
public List<Collider> IgnoredColliders = new List<Collider>();
|
||||
|
||||
public Transform Transform { get; private set; }
|
||||
public Transform FollowTransform { get; private set; }
|
||||
|
||||
public Vector3 PlanarDirection { get; set; }
|
||||
public float TargetDistance { get; set; }
|
||||
|
||||
private bool _distanceIsObstructed;
|
||||
private float _currentDistance;
|
||||
private float _targetVerticalAngle;
|
||||
private RaycastHit _obstructionHit;
|
||||
private int _obstructionCount;
|
||||
private RaycastHit[] _obstructions = new RaycastHit[MaxObstructions];
|
||||
private float _obstructionTime;
|
||||
private Vector3 _currentFollowPosition;
|
||||
|
||||
private const int MaxObstructions = 32;
|
||||
|
||||
void OnValidate()
|
||||
{
|
||||
DefaultDistance = Mathf.Clamp(DefaultDistance, MinDistance, MaxDistance);
|
||||
DefaultVerticalAngle = Mathf.Clamp(DefaultVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Transform = this.transform;
|
||||
|
||||
_currentDistance = DefaultDistance;
|
||||
TargetDistance = _currentDistance;
|
||||
|
||||
_targetVerticalAngle = 0f;
|
||||
|
||||
PlanarDirection = Vector3.forward;
|
||||
}
|
||||
|
||||
// Set the transform that the camera will orbit around
|
||||
public void SetFollowTransform(Transform t)
|
||||
{
|
||||
FollowTransform = t;
|
||||
PlanarDirection = FollowTransform.forward;
|
||||
_currentFollowPosition = FollowTransform.position;
|
||||
}
|
||||
|
||||
public void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)
|
||||
{
|
||||
if (FollowTransform)
|
||||
{
|
||||
if (InvertX)
|
||||
{
|
||||
rotationInput.x *= -1f;
|
||||
}
|
||||
if (InvertY)
|
||||
{
|
||||
rotationInput.y *= -1f;
|
||||
}
|
||||
|
||||
// Process rotation input
|
||||
Quaternion rotationFromInput = Quaternion.Euler(FollowTransform.up * (rotationInput.x * RotationSpeed));
|
||||
PlanarDirection = rotationFromInput * PlanarDirection;
|
||||
PlanarDirection = Vector3.Cross(FollowTransform.up, Vector3.Cross(PlanarDirection, FollowTransform.up));
|
||||
Quaternion planarRot = Quaternion.LookRotation(PlanarDirection, FollowTransform.up);
|
||||
|
||||
_targetVerticalAngle -= (rotationInput.y * RotationSpeed);
|
||||
_targetVerticalAngle = Mathf.Clamp(_targetVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
|
||||
Quaternion verticalRot = Quaternion.Euler(_targetVerticalAngle, 0, 0);
|
||||
Quaternion targetRotation = Quaternion.Slerp(Transform.rotation, planarRot * verticalRot, 1f - Mathf.Exp(-RotationSharpness * deltaTime));
|
||||
|
||||
// Apply rotation
|
||||
Transform.rotation = targetRotation;
|
||||
|
||||
// Process distance input
|
||||
if (_distanceIsObstructed && Mathf.Abs(zoomInput) > 0f)
|
||||
{
|
||||
TargetDistance = _currentDistance;
|
||||
}
|
||||
TargetDistance += zoomInput * DistanceMovementSpeed;
|
||||
TargetDistance = Mathf.Clamp(TargetDistance, MinDistance, MaxDistance);
|
||||
|
||||
// Find the smoothed follow position
|
||||
_currentFollowPosition = Vector3.Lerp(_currentFollowPosition, FollowTransform.position, 1f - Mathf.Exp(-FollowingSharpness * deltaTime));
|
||||
|
||||
// Handle obstructions
|
||||
{
|
||||
RaycastHit closestHit = new RaycastHit();
|
||||
closestHit.distance = Mathf.Infinity;
|
||||
_obstructionCount = Physics.SphereCastNonAlloc(_currentFollowPosition, ObstructionCheckRadius, -Transform.forward, _obstructions, TargetDistance, ObstructionLayers, QueryTriggerInteraction.Ignore);
|
||||
for (int i = 0; i < _obstructionCount; i++)
|
||||
{
|
||||
bool isIgnored = false;
|
||||
for (int j = 0; j < IgnoredColliders.Count; j++)
|
||||
{
|
||||
if (IgnoredColliders[j] == _obstructions[i].collider)
|
||||
{
|
||||
isIgnored = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < IgnoredColliders.Count; j++)
|
||||
{
|
||||
if (IgnoredColliders[j] == _obstructions[i].collider)
|
||||
{
|
||||
isIgnored = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isIgnored && _obstructions[i].distance < closestHit.distance && _obstructions[i].distance > 0)
|
||||
{
|
||||
closestHit = _obstructions[i];
|
||||
}
|
||||
}
|
||||
|
||||
// If obstructions detecter
|
||||
if (closestHit.distance < Mathf.Infinity)
|
||||
{
|
||||
_distanceIsObstructed = true;
|
||||
_currentDistance = Mathf.Lerp(_currentDistance, closestHit.distance, 1 - Mathf.Exp(-ObstructionSharpness * deltaTime));
|
||||
}
|
||||
// If no obstruction
|
||||
else
|
||||
{
|
||||
_distanceIsObstructed = false;
|
||||
_currentDistance = Mathf.Lerp(_currentDistance, TargetDistance, 1 - Mathf.Exp(-DistanceMovementSharpness * deltaTime));
|
||||
}
|
||||
}
|
||||
|
||||
// Find the smoothed camera orbit position
|
||||
Vector3 targetPosition = _currentFollowPosition - ((targetRotation * Vector3.forward) * _currentDistance);
|
||||
|
||||
// Handle framing
|
||||
targetPosition += Transform.right * FollowPointFraming.x;
|
||||
targetPosition += Transform.up * FollowPointFraming.y;
|
||||
|
||||
// Apply position
|
||||
Transform.position = targetPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24092a40b02616e479baeb940325e339
|
||||
timeCreated: 1485657083
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,516 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using KinematicCharacterController;
|
||||
using System;
|
||||
|
||||
namespace KinematicCharacterController.Examples
|
||||
{
|
||||
public enum CharacterState
|
||||
{
|
||||
Default,
|
||||
}
|
||||
|
||||
public enum OrientationMethod
|
||||
{
|
||||
TowardsCamera,
|
||||
TowardsMovement,
|
||||
}
|
||||
|
||||
public struct PlayerCharacterInputs
|
||||
{
|
||||
public float MoveAxisForward;
|
||||
public float MoveAxisRight;
|
||||
public Quaternion CameraRotation;
|
||||
public bool JumpDown;
|
||||
public bool CrouchDown;
|
||||
public bool CrouchUp;
|
||||
}
|
||||
|
||||
public struct AICharacterInputs
|
||||
{
|
||||
public Vector3 MoveVector;
|
||||
public Vector3 LookVector;
|
||||
}
|
||||
|
||||
public enum BonusOrientationMethod
|
||||
{
|
||||
None,
|
||||
TowardsGravity,
|
||||
TowardsGroundSlopeAndGravity,
|
||||
}
|
||||
|
||||
public class ExampleCharacterController : MonoBehaviour, ICharacterController
|
||||
{
|
||||
public KinematicCharacterMotor Motor;
|
||||
|
||||
[Header("Stable Movement")]
|
||||
public float MaxStableMoveSpeed = 10f;
|
||||
public float StableMovementSharpness = 15f;
|
||||
public float OrientationSharpness = 10f;
|
||||
public OrientationMethod OrientationMethod = OrientationMethod.TowardsCamera;
|
||||
|
||||
[Header("Air Movement")]
|
||||
public float MaxAirMoveSpeed = 15f;
|
||||
public float AirAccelerationSpeed = 15f;
|
||||
public float Drag = 0.1f;
|
||||
|
||||
[Header("Jumping")]
|
||||
public bool AllowJumpingWhenSliding = false;
|
||||
public float JumpUpSpeed = 10f;
|
||||
public float JumpScalableForwardSpeed = 10f;
|
||||
public float JumpPreGroundingGraceTime = 0f;
|
||||
public float JumpPostGroundingGraceTime = 0f;
|
||||
|
||||
[Header("Misc")]
|
||||
public List<Collider> IgnoredColliders = new List<Collider>();
|
||||
public BonusOrientationMethod BonusOrientationMethod = BonusOrientationMethod.None;
|
||||
public float BonusOrientationSharpness = 10f;
|
||||
public Vector3 Gravity = new Vector3(0, -30f, 0);
|
||||
public Transform MeshRoot;
|
||||
public Transform CameraFollowPoint;
|
||||
public float CrouchedCapsuleHeight = 1f;
|
||||
|
||||
public CharacterState CurrentCharacterState { get; private set; }
|
||||
|
||||
private Collider[] _probedColliders = new Collider[8];
|
||||
private RaycastHit[] _probedHits = new RaycastHit[8];
|
||||
private Vector3 _moveInputVector;
|
||||
private Vector3 _lookInputVector;
|
||||
private bool _jumpRequested = false;
|
||||
private bool _jumpConsumed = false;
|
||||
private bool _jumpedThisFrame = false;
|
||||
private float _timeSinceJumpRequested = Mathf.Infinity;
|
||||
private float _timeSinceLastAbleToJump = 0f;
|
||||
private Vector3 _internalVelocityAdd = Vector3.zero;
|
||||
private bool _shouldBeCrouching = false;
|
||||
private bool _isCrouching = false;
|
||||
|
||||
private Vector3 lastInnerNormal = Vector3.zero;
|
||||
private Vector3 lastOuterNormal = Vector3.zero;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Handle initial state
|
||||
TransitionToState(CharacterState.Default);
|
||||
|
||||
// Assign the characterController to the motor
|
||||
Motor.CharacterController = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles movement state transitions and enter/exit callbacks
|
||||
/// </summary>
|
||||
public void TransitionToState(CharacterState newState)
|
||||
{
|
||||
CharacterState tmpInitialState = CurrentCharacterState;
|
||||
OnStateExit(tmpInitialState, newState);
|
||||
CurrentCharacterState = newState;
|
||||
OnStateEnter(newState, tmpInitialState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event when entering a state
|
||||
/// </summary>
|
||||
public void OnStateEnter(CharacterState state, CharacterState fromState)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case CharacterState.Default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event when exiting a state
|
||||
/// </summary>
|
||||
public void OnStateExit(CharacterState state, CharacterState toState)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case CharacterState.Default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called every frame by ExamplePlayer in order to tell the character what its inputs are
|
||||
/// </summary>
|
||||
public void SetInputs(ref PlayerCharacterInputs inputs)
|
||||
{
|
||||
// Clamp input
|
||||
Vector3 moveInputVector = Vector3.ClampMagnitude(new Vector3(inputs.MoveAxisRight, 0f, inputs.MoveAxisForward), 1f);
|
||||
|
||||
// Calculate camera direction and rotation on the character plane
|
||||
Vector3 cameraPlanarDirection = Vector3.ProjectOnPlane(inputs.CameraRotation * Vector3.forward, Motor.CharacterUp).normalized;
|
||||
if (cameraPlanarDirection.sqrMagnitude == 0f)
|
||||
{
|
||||
cameraPlanarDirection = Vector3.ProjectOnPlane(inputs.CameraRotation * Vector3.up, Motor.CharacterUp).normalized;
|
||||
}
|
||||
Quaternion cameraPlanarRotation = Quaternion.LookRotation(cameraPlanarDirection, Motor.CharacterUp);
|
||||
|
||||
switch (CurrentCharacterState)
|
||||
{
|
||||
case CharacterState.Default:
|
||||
{
|
||||
// Move and look inputs
|
||||
_moveInputVector = cameraPlanarRotation * moveInputVector;
|
||||
|
||||
switch (OrientationMethod)
|
||||
{
|
||||
case OrientationMethod.TowardsCamera:
|
||||
_lookInputVector = cameraPlanarDirection;
|
||||
break;
|
||||
case OrientationMethod.TowardsMovement:
|
||||
_lookInputVector = _moveInputVector.normalized;
|
||||
break;
|
||||
}
|
||||
|
||||
// Jumping input
|
||||
if (inputs.JumpDown)
|
||||
{
|
||||
_timeSinceJumpRequested = 0f;
|
||||
_jumpRequested = true;
|
||||
}
|
||||
|
||||
// Crouching input
|
||||
if (inputs.CrouchDown)
|
||||
{
|
||||
_shouldBeCrouching = true;
|
||||
|
||||
if (!_isCrouching)
|
||||
{
|
||||
_isCrouching = true;
|
||||
Motor.SetCapsuleDimensions(0.5f, CrouchedCapsuleHeight, CrouchedCapsuleHeight * 0.5f);
|
||||
MeshRoot.localScale = new Vector3(1f, 0.5f, 1f);
|
||||
}
|
||||
}
|
||||
else if (inputs.CrouchUp)
|
||||
{
|
||||
_shouldBeCrouching = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called every frame by the AI script in order to tell the character what its inputs are
|
||||
/// </summary>
|
||||
public void SetInputs(ref AICharacterInputs inputs)
|
||||
{
|
||||
_moveInputVector = inputs.MoveVector;
|
||||
_lookInputVector = inputs.LookVector;
|
||||
}
|
||||
|
||||
private Quaternion _tmpTransientRot;
|
||||
|
||||
/// <summary>
|
||||
/// (Called by KinematicCharacterMotor during its update cycle)
|
||||
/// This is called before the character begins its movement update
|
||||
/// </summary>
|
||||
public void BeforeCharacterUpdate(float deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// (Called by KinematicCharacterMotor during its update cycle)
|
||||
/// This is where you tell your character what its rotation should be right now.
|
||||
/// This is the ONLY place where you should set the character's rotation
|
||||
/// </summary>
|
||||
public void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
|
||||
{
|
||||
switch (CurrentCharacterState)
|
||||
{
|
||||
case CharacterState.Default:
|
||||
{
|
||||
if (_lookInputVector.sqrMagnitude > 0f && OrientationSharpness > 0f)
|
||||
{
|
||||
// Smoothly interpolate from current to target look direction
|
||||
Vector3 smoothedLookInputDirection = Vector3.Slerp(Motor.CharacterForward, _lookInputVector, 1 - Mathf.Exp(-OrientationSharpness * deltaTime)).normalized;
|
||||
|
||||
// Set the current rotation (which will be used by the KinematicCharacterMotor)
|
||||
currentRotation = Quaternion.LookRotation(smoothedLookInputDirection, Motor.CharacterUp);
|
||||
}
|
||||
|
||||
Vector3 currentUp = (currentRotation * Vector3.up);
|
||||
if (BonusOrientationMethod == BonusOrientationMethod.TowardsGravity)
|
||||
{
|
||||
// Rotate from current up to invert gravity
|
||||
Vector3 smoothedGravityDir = Vector3.Slerp(currentUp, -Gravity.normalized, 1 - Mathf.Exp(-BonusOrientationSharpness * deltaTime));
|
||||
currentRotation = Quaternion.FromToRotation(currentUp, smoothedGravityDir) * currentRotation;
|
||||
}
|
||||
else if (BonusOrientationMethod == BonusOrientationMethod.TowardsGroundSlopeAndGravity)
|
||||
{
|
||||
if (Motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
Vector3 initialCharacterBottomHemiCenter = Motor.TransientPosition + (currentUp * Motor.Capsule.radius);
|
||||
|
||||
Vector3 smoothedGroundNormal = Vector3.Slerp(Motor.CharacterUp, Motor.GroundingStatus.GroundNormal, 1 - Mathf.Exp(-BonusOrientationSharpness * deltaTime));
|
||||
currentRotation = Quaternion.FromToRotation(currentUp, smoothedGroundNormal) * currentRotation;
|
||||
|
||||
// Move the position to create a rotation around the bottom hemi center instead of around the pivot
|
||||
Motor.SetTransientPosition(initialCharacterBottomHemiCenter + (currentRotation * Vector3.down * Motor.Capsule.radius));
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 smoothedGravityDir = Vector3.Slerp(currentUp, -Gravity.normalized, 1 - Mathf.Exp(-BonusOrientationSharpness * deltaTime));
|
||||
currentRotation = Quaternion.FromToRotation(currentUp, smoothedGravityDir) * currentRotation;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 smoothedGravityDir = Vector3.Slerp(currentUp, Vector3.up, 1 - Mathf.Exp(-BonusOrientationSharpness * deltaTime));
|
||||
currentRotation = Quaternion.FromToRotation(currentUp, smoothedGravityDir) * currentRotation;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// (Called by KinematicCharacterMotor during its update cycle)
|
||||
/// This is where you tell your character what its velocity should be right now.
|
||||
/// This is the ONLY place where you can set the character's velocity
|
||||
/// </summary>
|
||||
public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
|
||||
{
|
||||
switch (CurrentCharacterState)
|
||||
{
|
||||
case CharacterState.Default:
|
||||
{
|
||||
// Ground movement
|
||||
if (Motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
float currentVelocityMagnitude = currentVelocity.magnitude;
|
||||
|
||||
Vector3 effectiveGroundNormal = Motor.GroundingStatus.GroundNormal;
|
||||
|
||||
// Reorient velocity on slope
|
||||
currentVelocity = Motor.GetDirectionTangentToSurface(currentVelocity, effectiveGroundNormal) * currentVelocityMagnitude;
|
||||
|
||||
// Calculate target velocity
|
||||
Vector3 inputRight = Vector3.Cross(_moveInputVector, Motor.CharacterUp);
|
||||
Vector3 reorientedInput = Vector3.Cross(effectiveGroundNormal, inputRight).normalized * _moveInputVector.magnitude;
|
||||
Vector3 targetMovementVelocity = reorientedInput * MaxStableMoveSpeed;
|
||||
|
||||
// Smooth movement Velocity
|
||||
currentVelocity = Vector3.Lerp(currentVelocity, targetMovementVelocity, 1f - Mathf.Exp(-StableMovementSharpness * deltaTime));
|
||||
}
|
||||
// Air movement
|
||||
else
|
||||
{
|
||||
// Add move input
|
||||
if (_moveInputVector.sqrMagnitude > 0f)
|
||||
{
|
||||
Vector3 addedVelocity = _moveInputVector * AirAccelerationSpeed * deltaTime;
|
||||
|
||||
Vector3 currentVelocityOnInputsPlane = Vector3.ProjectOnPlane(currentVelocity, Motor.CharacterUp);
|
||||
|
||||
// Limit air velocity from inputs
|
||||
if (currentVelocityOnInputsPlane.magnitude < MaxAirMoveSpeed)
|
||||
{
|
||||
// clamp addedVel to make total vel not exceed max vel on inputs plane
|
||||
Vector3 newTotal = Vector3.ClampMagnitude(currentVelocityOnInputsPlane + addedVelocity, MaxAirMoveSpeed);
|
||||
addedVelocity = newTotal - currentVelocityOnInputsPlane;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure added vel doesn't go in the direction of the already-exceeding velocity
|
||||
if (Vector3.Dot(currentVelocityOnInputsPlane, addedVelocity) > 0f)
|
||||
{
|
||||
addedVelocity = Vector3.ProjectOnPlane(addedVelocity, currentVelocityOnInputsPlane.normalized);
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent air-climbing sloped walls
|
||||
if (Motor.GroundingStatus.FoundAnyGround)
|
||||
{
|
||||
if (Vector3.Dot(currentVelocity + addedVelocity, addedVelocity) > 0f)
|
||||
{
|
||||
Vector3 perpenticularObstructionNormal = Vector3.Cross(Vector3.Cross(Motor.CharacterUp, Motor.GroundingStatus.GroundNormal), Motor.CharacterUp).normalized;
|
||||
addedVelocity = Vector3.ProjectOnPlane(addedVelocity, perpenticularObstructionNormal);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply added velocity
|
||||
currentVelocity += addedVelocity;
|
||||
}
|
||||
|
||||
// Gravity
|
||||
currentVelocity += Gravity * deltaTime;
|
||||
|
||||
// Drag
|
||||
currentVelocity *= (1f / (1f + (Drag * deltaTime)));
|
||||
}
|
||||
|
||||
// Handle jumping
|
||||
_jumpedThisFrame = false;
|
||||
_timeSinceJumpRequested += deltaTime;
|
||||
if (_jumpRequested)
|
||||
{
|
||||
// See if we actually are allowed to jump
|
||||
if (!_jumpConsumed && ((AllowJumpingWhenSliding ? Motor.GroundingStatus.FoundAnyGround : Motor.GroundingStatus.IsStableOnGround) || _timeSinceLastAbleToJump <= JumpPostGroundingGraceTime))
|
||||
{
|
||||
// Calculate jump direction before ungrounding
|
||||
Vector3 jumpDirection = Motor.CharacterUp;
|
||||
if (Motor.GroundingStatus.FoundAnyGround && !Motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
jumpDirection = Motor.GroundingStatus.GroundNormal;
|
||||
}
|
||||
|
||||
// Makes the character skip ground probing/snapping on its next update.
|
||||
// If this line weren't here, the character would remain snapped to the ground when trying to jump. Try commenting this line out and see.
|
||||
Motor.ForceUnground();
|
||||
|
||||
// Add to the return velocity and reset jump state
|
||||
currentVelocity += (jumpDirection * JumpUpSpeed) - Vector3.Project(currentVelocity, Motor.CharacterUp);
|
||||
currentVelocity += (_moveInputVector * JumpScalableForwardSpeed);
|
||||
_jumpRequested = false;
|
||||
_jumpConsumed = true;
|
||||
_jumpedThisFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Take into account additive velocity
|
||||
if (_internalVelocityAdd.sqrMagnitude > 0f)
|
||||
{
|
||||
currentVelocity += _internalVelocityAdd;
|
||||
_internalVelocityAdd = Vector3.zero;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// (Called by KinematicCharacterMotor during its update cycle)
|
||||
/// This is called after the character has finished its movement update
|
||||
/// </summary>
|
||||
public void AfterCharacterUpdate(float deltaTime)
|
||||
{
|
||||
switch (CurrentCharacterState)
|
||||
{
|
||||
case CharacterState.Default:
|
||||
{
|
||||
// Handle jump-related values
|
||||
{
|
||||
// Handle jumping pre-ground grace period
|
||||
if (_jumpRequested && _timeSinceJumpRequested > JumpPreGroundingGraceTime)
|
||||
{
|
||||
_jumpRequested = false;
|
||||
}
|
||||
|
||||
if (AllowJumpingWhenSliding ? Motor.GroundingStatus.FoundAnyGround : Motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
// If we're on a ground surface, reset jumping values
|
||||
if (!_jumpedThisFrame)
|
||||
{
|
||||
_jumpConsumed = false;
|
||||
}
|
||||
_timeSinceLastAbleToJump = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Keep track of time since we were last able to jump (for grace period)
|
||||
_timeSinceLastAbleToJump += deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle uncrouching
|
||||
if (_isCrouching && !_shouldBeCrouching)
|
||||
{
|
||||
// Do an overlap test with the character's standing height to see if there are any obstructions
|
||||
Motor.SetCapsuleDimensions(0.5f, 2f, 1f);
|
||||
if (Motor.CharacterOverlap(
|
||||
Motor.TransientPosition,
|
||||
Motor.TransientRotation,
|
||||
_probedColliders,
|
||||
Motor.CollidableLayers,
|
||||
QueryTriggerInteraction.Ignore) > 0)
|
||||
{
|
||||
// If obstructions, just stick to crouching dimensions
|
||||
Motor.SetCapsuleDimensions(0.5f, CrouchedCapsuleHeight, CrouchedCapsuleHeight * 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no obstructions, uncrouch
|
||||
MeshRoot.localScale = new Vector3(1f, 1f, 1f);
|
||||
_isCrouching = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PostGroundingUpdate(float deltaTime)
|
||||
{
|
||||
// Handle landing and leaving ground
|
||||
if (Motor.GroundingStatus.IsStableOnGround && !Motor.LastGroundingStatus.IsStableOnGround)
|
||||
{
|
||||
OnLanded();
|
||||
}
|
||||
else if (!Motor.GroundingStatus.IsStableOnGround && Motor.LastGroundingStatus.IsStableOnGround)
|
||||
{
|
||||
OnLeaveStableGround();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsColliderValidForCollisions(Collider coll)
|
||||
{
|
||||
if (IgnoredColliders.Count == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IgnoredColliders.Contains(coll))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnGroundHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnMovementHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddVelocity(Vector3 velocity)
|
||||
{
|
||||
switch (CurrentCharacterState)
|
||||
{
|
||||
case CharacterState.Default:
|
||||
{
|
||||
_internalVelocityAdd += velocity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, Vector3 atCharacterPosition, Quaternion atCharacterRotation, ref HitStabilityReport hitStabilityReport)
|
||||
{
|
||||
}
|
||||
|
||||
protected void OnLanded()
|
||||
{
|
||||
}
|
||||
|
||||
protected void OnLeaveStableGround()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnDiscreteCollisionDetected(Collider hitCollider)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76020eee813ed7844bcea94c5d5ce76a
|
||||
timeCreated: 1503446428
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,99 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using KinematicCharacterController;
|
||||
using KinematicCharacterController.Examples;
|
||||
|
||||
namespace KinematicCharacterController.Examples
|
||||
{
|
||||
public class ExamplePlayer : MonoBehaviour
|
||||
{
|
||||
public ExampleCharacterController Character;
|
||||
public ExampleCharacterCamera CharacterCamera;
|
||||
|
||||
private const string MouseXInput = "Mouse X";
|
||||
private const string MouseYInput = "Mouse Y";
|
||||
private const string MouseScrollInput = "Mouse ScrollWheel";
|
||||
private const string HorizontalInput = "Horizontal";
|
||||
private const string VerticalInput = "Vertical";
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
|
||||
// Tell camera to follow transform
|
||||
CharacterCamera.SetFollowTransform(Character.CameraFollowPoint);
|
||||
|
||||
// Ignore the character's collider(s) for camera obstruction checks
|
||||
CharacterCamera.IgnoredColliders.Clear();
|
||||
CharacterCamera.IgnoredColliders.AddRange(Character.GetComponentsInChildren<Collider>());
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
|
||||
HandleCharacterInput();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
// Handle rotating the camera along with physics movers
|
||||
if (CharacterCamera.RotateWithPhysicsMover && Character.Motor.AttachedRigidbody != null)
|
||||
{
|
||||
CharacterCamera.PlanarDirection = Character.Motor.AttachedRigidbody.GetComponent<PhysicsMover>().RotationDeltaFromInterpolation * CharacterCamera.PlanarDirection;
|
||||
CharacterCamera.PlanarDirection = Vector3.ProjectOnPlane(CharacterCamera.PlanarDirection, Character.Motor.CharacterUp).normalized;
|
||||
}
|
||||
|
||||
HandleCameraInput();
|
||||
}
|
||||
|
||||
private void HandleCameraInput()
|
||||
{
|
||||
// Create the look input vector for the camera
|
||||
float mouseLookAxisUp = Input.GetAxisRaw(MouseYInput);
|
||||
float mouseLookAxisRight = Input.GetAxisRaw(MouseXInput);
|
||||
Vector3 lookInputVector = new Vector3(mouseLookAxisRight, mouseLookAxisUp, 0f);
|
||||
|
||||
// Prevent moving the camera while the cursor isn't locked
|
||||
if (Cursor.lockState != CursorLockMode.Locked)
|
||||
{
|
||||
lookInputVector = Vector3.zero;
|
||||
}
|
||||
|
||||
// Input for zooming the camera (disabled in WebGL because it can cause problems)
|
||||
float scrollInput = -Input.GetAxis(MouseScrollInput);
|
||||
#if UNITY_WEBGL
|
||||
scrollInput = 0f;
|
||||
#endif
|
||||
|
||||
// Apply inputs to the camera
|
||||
CharacterCamera.UpdateWithInput(Time.deltaTime, scrollInput, lookInputVector);
|
||||
|
||||
// Handle toggling zoom level
|
||||
if (Input.GetMouseButtonDown(1))
|
||||
{
|
||||
CharacterCamera.TargetDistance = (CharacterCamera.TargetDistance == 0f) ? CharacterCamera.DefaultDistance : 0f;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleCharacterInput()
|
||||
{
|
||||
PlayerCharacterInputs characterInputs = new PlayerCharacterInputs();
|
||||
|
||||
// Build the CharacterInputs struct
|
||||
characterInputs.MoveAxisForward = Input.GetAxisRaw(VerticalInput);
|
||||
characterInputs.MoveAxisRight = Input.GetAxisRaw(HorizontalInput);
|
||||
characterInputs.CameraRotation = CharacterCamera.Transform.rotation;
|
||||
characterInputs.JumpDown = Input.GetKeyDown(KeyCode.Space);
|
||||
characterInputs.CrouchDown = Input.GetKeyDown(KeyCode.C);
|
||||
characterInputs.CrouchUp = Input.GetKeyUp(KeyCode.C);
|
||||
|
||||
// Apply inputs to character
|
||||
Character.SetInputs(ref characterInputs);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 461cd396e3fc7cc4eb9c92bde05c1b9a
|
||||
timeCreated: 1485657184
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user