├── .gitattributes ├── .gitignore ├── Assets ├── Assets.meta ├── Assets │ ├── Material1.mat │ ├── Material1.mat.meta │ ├── Objects.meta │ ├── Objects │ │ ├── Materials.meta │ │ ├── Materials │ │ │ ├── Environment.mat │ │ │ └── Environment.mat.meta │ │ ├── Meshes.meta │ │ ├── Meshes │ │ │ ├── Mushroom_01_a.fbx │ │ │ ├── Mushroom_01_a.fbx.meta │ │ │ ├── Mushroom_01_b.fbx │ │ │ ├── Mushroom_01_b.fbx.meta │ │ │ ├── Mushroom_01_c.fbx │ │ │ ├── Mushroom_01_c.fbx.meta │ │ │ ├── Mushroom_02_a.fbx │ │ │ ├── Mushroom_02_a.fbx.meta │ │ │ ├── Mushroom_02_c.fbx │ │ │ ├── Mushroom_02_c.fbx.meta │ │ │ ├── Rock_01_a.fbx │ │ │ ├── Rock_01_a.fbx.meta │ │ │ ├── Rock_01_b.fbx │ │ │ ├── Rock_01_b.fbx.meta │ │ │ ├── Tree_01_a.fbx │ │ │ ├── Tree_01_a.fbx.meta │ │ │ ├── Tree_01_b.fbx │ │ │ ├── Tree_01_b.fbx.meta │ │ │ ├── Tree_02_a.fbx │ │ │ ├── Tree_02_a.fbx.meta │ │ │ ├── Tree_02_b.fbx │ │ │ └── Tree_02_b.fbx.meta │ │ ├── Prefabs.meta │ │ ├── Prefabs │ │ │ ├── Mushroom_01_a.prefab │ │ │ ├── Mushroom_01_a.prefab.meta │ │ │ ├── Mushroom_01_b.prefab │ │ │ ├── Mushroom_01_b.prefab.meta │ │ │ ├── Mushroom_01_c.prefab │ │ │ ├── Mushroom_01_c.prefab.meta │ │ │ ├── Mushroom_02_a.prefab │ │ │ ├── Mushroom_02_a.prefab.meta │ │ │ ├── Mushroom_02_c.prefab │ │ │ ├── Mushroom_02_c.prefab.meta │ │ │ ├── Rock_01_a.prefab │ │ │ ├── Rock_01_a.prefab.meta │ │ │ ├── Rock_01_b.prefab │ │ │ ├── Rock_01_b.prefab.meta │ │ │ ├── Tree_01_a.prefab │ │ │ ├── Tree_01_a.prefab.meta │ │ │ ├── Tree_01_b.prefab │ │ │ ├── Tree_01_b.prefab.meta │ │ │ ├── Tree_02_a.prefab │ │ │ ├── Tree_02_a.prefab.meta │ │ │ ├── Tree_02_b.prefab │ │ │ └── Tree_02_b.prefab.meta │ │ ├── Textures.meta │ │ └── Textures │ │ │ ├── Environment.tga │ │ │ └── Environment.tga.meta │ ├── Rotate.js │ ├── Rotate.js.meta │ ├── Skybox.meta │ ├── Skybox │ │ ├── Materials.meta │ │ ├── Materials │ │ │ ├── Sunny 01B.mat │ │ │ └── Sunny 01B.mat.meta │ │ ├── Textures.meta │ │ └── Textures │ │ │ ├── Sunny_01A_down.tga │ │ │ ├── Sunny_01A_down.tga.meta │ │ │ ├── Sunny_01B_back.tga │ │ │ ├── Sunny_01B_back.tga.meta │ │ │ ├── Sunny_01B_down.tga │ │ │ ├── Sunny_01B_down.tga.meta │ │ │ ├── Sunny_01B_front.tga │ │ │ ├── Sunny_01B_front.tga.meta │ │ │ ├── Sunny_01B_left.tga │ │ │ ├── Sunny_01B_left.tga.meta │ │ │ ├── Sunny_01B_right.tga │ │ │ ├── Sunny_01B_right.tga.meta │ │ │ ├── Sunny_01B_up.tga │ │ │ └── Sunny_01B_up.tga.meta │ ├── Standard Assets.meta │ └── Standard Assets │ │ ├── Character Controllers.meta │ │ └── Character Controllers │ │ ├── Sources.meta │ │ └── Sources │ │ ├── Scripts.meta │ │ └── Scripts │ │ ├── CharacterMotor.js │ │ ├── CharacterMotor.js.meta │ │ ├── FPSInputController.js │ │ ├── FPSInputController.js.meta │ │ ├── MouseLook.cs │ │ ├── MouseLook.cs.meta │ │ ├── PlatformInputController.js │ │ ├── PlatformInputController.js.meta │ │ ├── ThirdPersonCamera.js │ │ ├── ThirdPersonCamera.js.meta │ │ ├── ThirdPersonController.js │ │ └── ThirdPersonController.js.meta ├── Example-Scene.unity ├── Example-Scene.unity.meta ├── MirrorReflection.meta └── MirrorReflection │ ├── MirrorReflection.cs │ ├── MirrorReflection.cs.meta │ ├── MirrorReflection.mat │ ├── MirrorReflection.mat.meta │ ├── MirrorReflection.shader │ └── MirrorReflection.shader.meta ├── ProjectSettings ├── AudioManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshLayers.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── TagManager.asset └── TimeManager.asset └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /Assets/Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb0d6c4b9e224584b9ad3695822dd54b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Material1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Material1.mat -------------------------------------------------------------------------------- /Assets/Assets/Material1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 074b606cc13ac5d44982e0d000750f50 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 12615896e8fdef84e9af0a16540013a2 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e07ff72f7295866418bc49c024ab3cfe 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Materials/Environment.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Materials/Environment.mat -------------------------------------------------------------------------------- /Assets/Assets/Objects/Materials/Environment.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e34e59f26095e4e9497473c995eedceb 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4dba7a847f841f468c0844e5c1c8f4b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_01_a.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Mushroom_01_a.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_01_a.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64de7a6a5b68a4145baa7525a8a28811 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Mushroom_01_a 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_01_b.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Mushroom_01_b.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_01_b.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 636a414d8efb640db9d24387f8e85a2b 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Mushroom_01_b 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_01_c.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Mushroom_01_c.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_01_c.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 578a7fed1fa54475e947e5276d9a1483 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Mushroom_01_c 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_02_a.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Mushroom_02_a.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_02_a.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58b26389099b14b34bfe8ae6a871d58d 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Mushroom_02_a 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_02_c.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Mushroom_02_c.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Mushroom_02_c.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e89854d27591546dbbe98aac09c4fe34 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Mushroom_02_c 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Rock_01_a.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Rock_01_a.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Rock_01_a.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9cf3dbc2bbeae42c1b931d75fdf45b2e 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Rock_01_a 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Rock_01_b.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Rock_01_b.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Rock_01_b.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b60e8d4da16e84785b19bbaf5c032b58 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Rock_01_b 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_01_a.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Tree_01_a.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_01_a.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 778f048e230f845afb20c56d3cc734df 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Tree_01_a 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_01_b.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Tree_01_b.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_01_b.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 136f9616bfbdc40b2a47231a39e7f3c8 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Tree_01_b 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_02_a.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Tree_02_a.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_02_a.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7adf73f1a12f1442b8a5b383b690b306 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Tree_02_a 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_02_b.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Meshes/Tree_02_b.fbx -------------------------------------------------------------------------------- /Assets/Assets/Objects/Meshes/Tree_02_b.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a940905d6bb25428dab5116efc22618f 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Tree_02_b 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 0 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .00999999978 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 0 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 1 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6bb867802dddbd4ca50ef322a578722 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_01_a.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Mushroom_01_a.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_01_a.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fadeee601d714e778f7909e98a7924b 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_01_b.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Mushroom_01_b.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_01_b.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c3b1808e370d4b07b3f6e1605b13777 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_01_c.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Mushroom_01_c.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_01_c.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aeaafaf5fd3824c28a5ce2609b3bff3e 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_02_a.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Mushroom_02_a.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_02_a.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2feb5a10f4f4414d843b8fb9ec4f0a1 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_02_c.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Mushroom_02_c.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Mushroom_02_c.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aed43bc9bc2414e9181cfc501e683f23 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Rock_01_a.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Rock_01_a.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Rock_01_a.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1770a7f1494b461cbb9bd1bf9b38259 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Rock_01_b.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Rock_01_b.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Rock_01_b.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faf62da5da3c64ae9babc578f6eb66ed 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_01_a.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Tree_01_a.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_01_a.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 802761cfaeeb54502a78ecac6acfcb45 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_01_b.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Tree_01_b.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_01_b.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21a9cba159c414831a586ac2371c5b25 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_02_a.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Tree_02_a.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_02_a.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a0893db7d30c42c1838c30b3f8f7cb9 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_02_b.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Prefabs/Tree_02_b.prefab -------------------------------------------------------------------------------- /Assets/Assets/Objects/Prefabs/Tree_02_b.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aaf85a652c3c7448284f84185516bfda 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 620b86bf387ea164bb8bb7700ef4592b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Objects/Textures/Environment.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Objects/Textures/Environment.tga -------------------------------------------------------------------------------- /Assets/Assets/Objects/Textures/Environment.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f10a83dd0a52b4b4d854e61253e8a0f9 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -1 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 0 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: 0 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Rotate.js: -------------------------------------------------------------------------------- 1 | 2 | function Update () { 3 | transform.Rotate( 0, Time.deltaTime * 10, 0 ); 4 | } -------------------------------------------------------------------------------- /Assets/Assets/Rotate.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6125848e7ea704aafb292c88b3af1303 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c71aa167795969448de0d8f83f7b937 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 548e9e9897e324846bf3ef1e5bbc59e1 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Materials/Sunny 01B.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Materials/Sunny 01B.mat -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Materials/Sunny 01B.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1f809f9000434f4d976f132684abbea 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0156c8acda5ca2e4284c26aff309566b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01A_down.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Textures/Sunny_01A_down.tga -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01A_down.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 079c5adb913e54618a451eba706bd8f9 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -3 25 | maxTextureSize: 256 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_back.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Textures/Sunny_01B_back.tga -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_back.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9ad80a15ae904d2283ae8519fbd45f4 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -3 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_down.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Textures/Sunny_01B_down.tga -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_down.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9d83c8b7ee4294640bbd0b19d5a6edf4 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -3 25 | maxTextureSize: 256 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_front.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Textures/Sunny_01B_front.tga -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_front.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d6e18ea8f6924015958ade1a0129d1c 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -3 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_left.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Textures/Sunny_01B_left.tga -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_left.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2516388be70b4f5eb4ed22add006066 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -3 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_right.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Textures/Sunny_01B_right.tga -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_right.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec2fd6f24d629416099bed20c15a38ca 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -3 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_up.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Assets/Skybox/Textures/Sunny_01B_up.tga -------------------------------------------------------------------------------- /Assets/Assets/Skybox/Textures/Sunny_01B_up.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a99524d7ee55b402e8cc892d657b03fc 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -3 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: 1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7098436a23f84754fabaab4bb32175ea 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91e6d27614b57954a8e39951f508e9b5 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 10c02712c7b56c547aeefcb9939a15ec 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a8ebbfd7ab397944b68be6c5c9a28a3 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js: -------------------------------------------------------------------------------- 1 | #pragma strict 2 | #pragma implicit 3 | #pragma downcast 4 | 5 | // Does this script currently respond to input? 6 | var canControl : boolean = true; 7 | 8 | var useFixedUpdate : boolean = true; 9 | 10 | // For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view. 11 | // Very handy for organization! 12 | 13 | // The current global direction we want the character to move in. 14 | @System.NonSerialized 15 | var inputMoveDirection : Vector3 = Vector3.zero; 16 | 17 | // Is the jump button held down? We use this interface instead of checking 18 | // for the jump button directly so this script can also be used by AIs. 19 | @System.NonSerialized 20 | var inputJump : boolean = false; 21 | 22 | class CharacterMotorMovement { 23 | // The maximum horizontal speed when moving 24 | var maxForwardSpeed : float = 10.0; 25 | var maxSidewaysSpeed : float = 10.0; 26 | var maxBackwardsSpeed : float = 10.0; 27 | 28 | // Curve for multiplying speed based on slope (negative = downwards) 29 | var slopeSpeedMultiplier : AnimationCurve = AnimationCurve(Keyframe(-90, 1), Keyframe(0, 1), Keyframe(90, 0)); 30 | 31 | // How fast does the character change speeds? Higher is faster. 32 | var maxGroundAcceleration : float = 30.0; 33 | var maxAirAcceleration : float = 20.0; 34 | 35 | // The gravity for the character 36 | var gravity : float = 10.0; 37 | var maxFallSpeed : float = 20.0; 38 | 39 | // For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view. 40 | // Very handy for organization! 41 | 42 | // The last collision flags returned from controller.Move 43 | @System.NonSerialized 44 | var collisionFlags : CollisionFlags; 45 | 46 | // We will keep track of the character's current velocity, 47 | @System.NonSerialized 48 | var velocity : Vector3; 49 | 50 | // This keeps track of our current velocity while we're not grounded 51 | @System.NonSerialized 52 | var frameVelocity : Vector3 = Vector3.zero; 53 | 54 | @System.NonSerialized 55 | var hitPoint : Vector3 = Vector3.zero; 56 | 57 | @System.NonSerialized 58 | var lastHitPoint : Vector3 = Vector3(Mathf.Infinity, 0, 0); 59 | } 60 | 61 | var movement : CharacterMotorMovement = CharacterMotorMovement(); 62 | 63 | enum MovementTransferOnJump { 64 | None, // The jump is not affected by velocity of floor at all. 65 | InitTransfer, // Jump gets its initial velocity from the floor, then gradualy comes to a stop. 66 | PermaTransfer, // Jump gets its initial velocity from the floor, and keeps that velocity until landing. 67 | PermaLocked // Jump is relative to the movement of the last touched floor and will move together with that floor. 68 | } 69 | 70 | // We will contain all the jumping related variables in one helper class for clarity. 71 | class CharacterMotorJumping { 72 | // Can the character jump? 73 | var enabled : boolean = true; 74 | 75 | // How high do we jump when pressing jump and letting go immediately 76 | var baseHeight : float = 1.0; 77 | 78 | // We add extraHeight units (meters) on top when holding the button down longer while jumping 79 | var extraHeight : float = 4.1; 80 | 81 | // How much does the character jump out perpendicular to the surface on walkable surfaces? 82 | // 0 means a fully vertical jump and 1 means fully perpendicular. 83 | var perpAmount : float = 0.0; 84 | 85 | // How much does the character jump out perpendicular to the surface on too steep surfaces? 86 | // 0 means a fully vertical jump and 1 means fully perpendicular. 87 | var steepPerpAmount : float = 0.5; 88 | 89 | // For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view. 90 | // Very handy for organization! 91 | 92 | // Are we jumping? (Initiated with jump button and not grounded yet) 93 | // To see if we are just in the air (initiated by jumping OR falling) see the grounded variable. 94 | @System.NonSerialized 95 | var jumping : boolean = false; 96 | 97 | @System.NonSerialized 98 | var holdingJumpButton : boolean = false; 99 | 100 | // the time we jumped at (Used to determine for how long to apply extra jump power after jumping.) 101 | @System.NonSerialized 102 | var lastStartTime : float = 0.0; 103 | 104 | @System.NonSerialized 105 | var lastButtonDownTime : float = -100; 106 | 107 | @System.NonSerialized 108 | var jumpDir : Vector3 = Vector3.up; 109 | } 110 | 111 | var jumping : CharacterMotorJumping = CharacterMotorJumping(); 112 | 113 | class CharacterMotorMovingPlatform { 114 | var enabled : boolean = true; 115 | 116 | var movementTransfer : MovementTransferOnJump = MovementTransferOnJump.PermaTransfer; 117 | 118 | @System.NonSerialized 119 | var hitPlatform : Transform; 120 | 121 | @System.NonSerialized 122 | var activePlatform : Transform; 123 | 124 | @System.NonSerialized 125 | var activeLocalPoint : Vector3; 126 | 127 | @System.NonSerialized 128 | var activeGlobalPoint : Vector3; 129 | 130 | @System.NonSerialized 131 | var activeLocalRotation : Quaternion; 132 | 133 | @System.NonSerialized 134 | var activeGlobalRotation : Quaternion; 135 | 136 | @System.NonSerialized 137 | var lastMatrix : Matrix4x4; 138 | 139 | @System.NonSerialized 140 | var platformVelocity : Vector3; 141 | 142 | @System.NonSerialized 143 | var newPlatform : boolean; 144 | } 145 | 146 | var movingPlatform : CharacterMotorMovingPlatform = CharacterMotorMovingPlatform(); 147 | 148 | class CharacterMotorSliding { 149 | // Does the character slide on too steep surfaces? 150 | var enabled : boolean = true; 151 | 152 | // How fast does the character slide on steep surfaces? 153 | var slidingSpeed : float = 15; 154 | 155 | // How much can the player control the sliding direction? 156 | // If the value is 0.5 the player can slide sideways with half the speed of the downwards sliding speed. 157 | var sidewaysControl : float = 1.0; 158 | 159 | // How much can the player influence the sliding speed? 160 | // If the value is 0.5 the player can speed the sliding up to 150% or slow it down to 50%. 161 | var speedControl : float = 0.4; 162 | } 163 | 164 | var sliding : CharacterMotorSliding = CharacterMotorSliding(); 165 | 166 | @System.NonSerialized 167 | var grounded : boolean = true; 168 | 169 | @System.NonSerialized 170 | var groundNormal : Vector3 = Vector3.zero; 171 | 172 | private var lastGroundNormal : Vector3 = Vector3.zero; 173 | 174 | private var tr : Transform; 175 | 176 | private var controller : CharacterController; 177 | 178 | function Awake () { 179 | controller = GetComponent (CharacterController); 180 | tr = transform; 181 | } 182 | 183 | private function UpdateFunction () { 184 | // We copy the actual velocity into a temporary variable that we can manipulate. 185 | var velocity : Vector3 = movement.velocity; 186 | 187 | // Update velocity based on input 188 | velocity = ApplyInputVelocityChange(velocity); 189 | 190 | // Apply gravity and jumping force 191 | velocity = ApplyGravityAndJumping (velocity); 192 | 193 | // Moving platform support 194 | var moveDistance : Vector3 = Vector3.zero; 195 | if (MoveWithPlatform()) { 196 | var newGlobalPoint : Vector3 = movingPlatform.activePlatform.TransformPoint(movingPlatform.activeLocalPoint); 197 | moveDistance = (newGlobalPoint - movingPlatform.activeGlobalPoint); 198 | if (moveDistance != Vector3.zero) 199 | controller.Move(moveDistance); 200 | 201 | // Support moving platform rotation as well: 202 | var newGlobalRotation : Quaternion = movingPlatform.activePlatform.rotation * movingPlatform.activeLocalRotation; 203 | var rotationDiff : Quaternion = newGlobalRotation * Quaternion.Inverse(movingPlatform.activeGlobalRotation); 204 | 205 | var yRotation = rotationDiff.eulerAngles.y; 206 | if (yRotation != 0) { 207 | // Prevent rotation of the local up vector 208 | tr.Rotate(0, yRotation, 0); 209 | } 210 | } 211 | 212 | // Save lastPosition for velocity calculation. 213 | var lastPosition : Vector3 = tr.position; 214 | 215 | // We always want the movement to be framerate independent. Multiplying by Time.deltaTime does this. 216 | var currentMovementOffset : Vector3 = velocity * Time.deltaTime; 217 | 218 | // Find out how much we need to push towards the ground to avoid loosing grouning 219 | // when walking down a step or over a sharp change in slope. 220 | var pushDownOffset : float = Mathf.Max(controller.stepOffset, Vector3(currentMovementOffset.x, 0, currentMovementOffset.z).magnitude); 221 | if (grounded) 222 | currentMovementOffset -= pushDownOffset * Vector3.up; 223 | 224 | // Reset variables that will be set by collision function 225 | movingPlatform.hitPlatform = null; 226 | groundNormal = Vector3.zero; 227 | 228 | // Move our character! 229 | movement.collisionFlags = controller.Move (currentMovementOffset); 230 | 231 | movement.lastHitPoint = movement.hitPoint; 232 | lastGroundNormal = groundNormal; 233 | 234 | if (movingPlatform.enabled && movingPlatform.activePlatform != movingPlatform.hitPlatform) { 235 | if (movingPlatform.hitPlatform != null) { 236 | movingPlatform.activePlatform = movingPlatform.hitPlatform; 237 | movingPlatform.lastMatrix = movingPlatform.hitPlatform.localToWorldMatrix; 238 | movingPlatform.newPlatform = true; 239 | } 240 | } 241 | 242 | // Calculate the velocity based on the current and previous position. 243 | // This means our velocity will only be the amount the character actually moved as a result of collisions. 244 | var oldHVelocity : Vector3 = new Vector3(velocity.x, 0, velocity.z); 245 | movement.velocity = (tr.position - lastPosition) / Time.deltaTime; 246 | var newHVelocity : Vector3 = new Vector3(movement.velocity.x, 0, movement.velocity.z); 247 | 248 | // The CharacterController can be moved in unwanted directions when colliding with things. 249 | // We want to prevent this from influencing the recorded velocity. 250 | if (oldHVelocity == Vector3.zero) { 251 | movement.velocity = new Vector3(0, movement.velocity.y, 0); 252 | } 253 | else { 254 | var projectedNewVelocity : float = Vector3.Dot(newHVelocity, oldHVelocity) / oldHVelocity.sqrMagnitude; 255 | movement.velocity = oldHVelocity * Mathf.Clamp01(projectedNewVelocity) + movement.velocity.y * Vector3.up; 256 | } 257 | 258 | if (movement.velocity.y < velocity.y - 0.001) { 259 | if (movement.velocity.y < 0) { 260 | // Something is forcing the CharacterController down faster than it should. 261 | // Ignore this 262 | movement.velocity.y = velocity.y; 263 | } 264 | else { 265 | // The upwards movement of the CharacterController has been blocked. 266 | // This is treated like a ceiling collision - stop further jumping here. 267 | jumping.holdingJumpButton = false; 268 | } 269 | } 270 | 271 | // We were grounded but just loosed grounding 272 | if (grounded && !IsGroundedTest()) { 273 | grounded = false; 274 | 275 | // Apply inertia from platform 276 | if (movingPlatform.enabled && 277 | (movingPlatform.movementTransfer == MovementTransferOnJump.InitTransfer || 278 | movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) 279 | ) { 280 | movement.frameVelocity = movingPlatform.platformVelocity; 281 | movement.velocity += movingPlatform.platformVelocity; 282 | } 283 | 284 | SendMessage("OnFall", SendMessageOptions.DontRequireReceiver); 285 | // We pushed the character down to ensure it would stay on the ground if there was any. 286 | // But there wasn't so now we cancel the downwards offset to make the fall smoother. 287 | tr.position += pushDownOffset * Vector3.up; 288 | } 289 | // We were not grounded but just landed on something 290 | else if (!grounded && IsGroundedTest()) { 291 | grounded = true; 292 | jumping.jumping = false; 293 | SubtractNewPlatformVelocity(); 294 | 295 | SendMessage("OnLand", SendMessageOptions.DontRequireReceiver); 296 | } 297 | 298 | // Moving platforms support 299 | if (MoveWithPlatform()) { 300 | // Use the center of the lower half sphere of the capsule as reference point. 301 | // This works best when the character is standing on moving tilting platforms. 302 | movingPlatform.activeGlobalPoint = tr.position + Vector3.up * (controller.center.y - controller.height*0.5 + controller.radius); 303 | movingPlatform.activeLocalPoint = movingPlatform.activePlatform.InverseTransformPoint(movingPlatform.activeGlobalPoint); 304 | 305 | // Support moving platform rotation as well: 306 | movingPlatform.activeGlobalRotation = tr.rotation; 307 | movingPlatform.activeLocalRotation = Quaternion.Inverse(movingPlatform.activePlatform.rotation) * movingPlatform.activeGlobalRotation; 308 | } 309 | } 310 | 311 | function FixedUpdate () { 312 | if (movingPlatform.enabled) { 313 | if (movingPlatform.activePlatform != null) { 314 | if (!movingPlatform.newPlatform) { 315 | var lastVelocity : Vector3 = movingPlatform.platformVelocity; 316 | 317 | movingPlatform.platformVelocity = ( 318 | movingPlatform.activePlatform.localToWorldMatrix.MultiplyPoint3x4(movingPlatform.activeLocalPoint) 319 | - movingPlatform.lastMatrix.MultiplyPoint3x4(movingPlatform.activeLocalPoint) 320 | ) / Time.deltaTime; 321 | } 322 | movingPlatform.lastMatrix = movingPlatform.activePlatform.localToWorldMatrix; 323 | movingPlatform.newPlatform = false; 324 | } 325 | else { 326 | movingPlatform.platformVelocity = Vector3.zero; 327 | } 328 | } 329 | 330 | if (useFixedUpdate) 331 | UpdateFunction(); 332 | } 333 | 334 | function Update () { 335 | if (!useFixedUpdate) 336 | UpdateFunction(); 337 | } 338 | 339 | private function ApplyInputVelocityChange (velocity : Vector3) { 340 | if (!canControl) 341 | inputMoveDirection = Vector3.zero; 342 | 343 | // Find desired velocity 344 | var desiredVelocity : Vector3; 345 | if (grounded && TooSteep()) { 346 | // The direction we're sliding in 347 | desiredVelocity = Vector3(groundNormal.x, 0, groundNormal.z).normalized; 348 | // Find the input movement direction projected onto the sliding direction 349 | var projectedMoveDir = Vector3.Project(inputMoveDirection, desiredVelocity); 350 | // Add the sliding direction, the spped control, and the sideways control vectors 351 | desiredVelocity = desiredVelocity + projectedMoveDir * sliding.speedControl + (inputMoveDirection - projectedMoveDir) * sliding.sidewaysControl; 352 | // Multiply with the sliding speed 353 | desiredVelocity *= sliding.slidingSpeed; 354 | } 355 | else 356 | desiredVelocity = GetDesiredHorizontalVelocity(); 357 | 358 | if (movingPlatform.enabled && movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) { 359 | desiredVelocity += movement.frameVelocity; 360 | desiredVelocity.y = 0; 361 | } 362 | 363 | if (grounded) 364 | desiredVelocity = AdjustGroundVelocityToNormal(desiredVelocity, groundNormal); 365 | else 366 | velocity.y = 0; 367 | 368 | // Enforce max velocity change 369 | var maxVelocityChange : float = GetMaxAcceleration(grounded) * Time.deltaTime; 370 | var velocityChangeVector : Vector3 = (desiredVelocity - velocity); 371 | if (velocityChangeVector.sqrMagnitude > maxVelocityChange * maxVelocityChange) { 372 | velocityChangeVector = velocityChangeVector.normalized * maxVelocityChange; 373 | } 374 | // If we're in the air and don't have control, don't apply any velocity change at all. 375 | // If we're on the ground and don't have control we do apply it - it will correspond to friction. 376 | if (grounded || canControl) 377 | velocity += velocityChangeVector; 378 | 379 | if (grounded) { 380 | // When going uphill, the CharacterController will automatically move up by the needed amount. 381 | // Not moving it upwards manually prevent risk of lifting off from the ground. 382 | // When going downhill, DO move down manually, as gravity is not enough on steep hills. 383 | velocity.y = Mathf.Min(velocity.y, 0); 384 | } 385 | 386 | return velocity; 387 | } 388 | 389 | private function ApplyGravityAndJumping (velocity : Vector3) { 390 | 391 | if (!inputJump || !canControl) { 392 | jumping.holdingJumpButton = false; 393 | jumping.lastButtonDownTime = -100; 394 | } 395 | 396 | if (inputJump && jumping.lastButtonDownTime < 0 && canControl) 397 | jumping.lastButtonDownTime = Time.time; 398 | 399 | if (grounded) 400 | velocity.y = Mathf.Min(0, velocity.y) - movement.gravity * Time.deltaTime; 401 | else { 402 | velocity.y = movement.velocity.y - movement.gravity * Time.deltaTime; 403 | 404 | // When jumping up we don't apply gravity for some time when the user is holding the jump button. 405 | // This gives more control over jump height by pressing the button longer. 406 | if (jumping.jumping && jumping.holdingJumpButton) { 407 | // Calculate the duration that the extra jump force should have effect. 408 | // If we're still less than that duration after the jumping time, apply the force. 409 | if (Time.time < jumping.lastStartTime + jumping.extraHeight / CalculateJumpVerticalSpeed(jumping.baseHeight)) { 410 | // Negate the gravity we just applied, except we push in jumpDir rather than jump upwards. 411 | velocity += jumping.jumpDir * movement.gravity * Time.deltaTime; 412 | } 413 | } 414 | 415 | // Make sure we don't fall any faster than maxFallSpeed. This gives our character a terminal velocity. 416 | velocity.y = Mathf.Max (velocity.y, -movement.maxFallSpeed); 417 | } 418 | 419 | if (grounded) { 420 | // Jump only if the jump button was pressed down in the last 0.2 seconds. 421 | // We use this check instead of checking if it's pressed down right now 422 | // because players will often try to jump in the exact moment when hitting the ground after a jump 423 | // and if they hit the button a fraction of a second too soon and no new jump happens as a consequence, 424 | // it's confusing and it feels like the game is buggy. 425 | if (jumping.enabled && canControl && (Time.time - jumping.lastButtonDownTime < 0.2)) { 426 | grounded = false; 427 | jumping.jumping = true; 428 | jumping.lastStartTime = Time.time; 429 | jumping.lastButtonDownTime = -100; 430 | jumping.holdingJumpButton = true; 431 | 432 | // Calculate the jumping direction 433 | if (TooSteep()) 434 | jumping.jumpDir = Vector3.Slerp(Vector3.up, groundNormal, jumping.steepPerpAmount); 435 | else 436 | jumping.jumpDir = Vector3.Slerp(Vector3.up, groundNormal, jumping.perpAmount); 437 | 438 | // Apply the jumping force to the velocity. Cancel any vertical velocity first. 439 | velocity.y = 0; 440 | velocity += jumping.jumpDir * CalculateJumpVerticalSpeed (jumping.baseHeight); 441 | 442 | // Apply inertia from platform 443 | if (movingPlatform.enabled && 444 | (movingPlatform.movementTransfer == MovementTransferOnJump.InitTransfer || 445 | movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) 446 | ) { 447 | movement.frameVelocity = movingPlatform.platformVelocity; 448 | velocity += movingPlatform.platformVelocity; 449 | } 450 | 451 | SendMessage("OnJump", SendMessageOptions.DontRequireReceiver); 452 | } 453 | else { 454 | jumping.holdingJumpButton = false; 455 | } 456 | } 457 | 458 | return velocity; 459 | } 460 | 461 | function OnControllerColliderHit (hit : ControllerColliderHit) { 462 | if (hit.normal.y > 0 && hit.normal.y > groundNormal.y && hit.moveDirection.y < 0) { 463 | if ((hit.point - movement.lastHitPoint).sqrMagnitude > 0.001 || lastGroundNormal == Vector3.zero) 464 | groundNormal = hit.normal; 465 | else 466 | groundNormal = lastGroundNormal; 467 | 468 | movingPlatform.hitPlatform = hit.collider.transform; 469 | movement.hitPoint = hit.point; 470 | movement.frameVelocity = Vector3.zero; 471 | } 472 | } 473 | 474 | private function SubtractNewPlatformVelocity () { 475 | // When landing, subtract the velocity of the new ground from the character's velocity 476 | // since movement in ground is relative to the movement of the ground. 477 | if (movingPlatform.enabled && 478 | (movingPlatform.movementTransfer == MovementTransferOnJump.InitTransfer || 479 | movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) 480 | ) { 481 | // If we landed on a new platform, we have to wait for two FixedUpdates 482 | // before we know the velocity of the platform under the character 483 | if (movingPlatform.newPlatform) { 484 | var platform : Transform = movingPlatform.activePlatform; 485 | yield WaitForFixedUpdate(); 486 | yield WaitForFixedUpdate(); 487 | if (grounded && platform == movingPlatform.activePlatform) 488 | yield 1; 489 | } 490 | movement.velocity -= movingPlatform.platformVelocity; 491 | } 492 | } 493 | 494 | private function MoveWithPlatform () : boolean { 495 | return ( 496 | movingPlatform.enabled 497 | && (grounded || movingPlatform.movementTransfer == MovementTransferOnJump.PermaLocked) 498 | && movingPlatform.activePlatform != null 499 | ); 500 | } 501 | 502 | private function GetDesiredHorizontalVelocity () { 503 | // Find desired velocity 504 | var desiredLocalDirection : Vector3 = tr.InverseTransformDirection(inputMoveDirection); 505 | var maxSpeed : float = MaxSpeedInDirection(desiredLocalDirection); 506 | if (grounded) { 507 | // Modify max speed on slopes based on slope speed multiplier curve 508 | var movementSlopeAngle = Mathf.Asin(movement.velocity.normalized.y) * Mathf.Rad2Deg; 509 | maxSpeed *= movement.slopeSpeedMultiplier.Evaluate(movementSlopeAngle); 510 | } 511 | return tr.TransformDirection(desiredLocalDirection * maxSpeed); 512 | } 513 | 514 | private function AdjustGroundVelocityToNormal (hVelocity : Vector3, groundNormal : Vector3) : Vector3 { 515 | var sideways : Vector3 = Vector3.Cross(Vector3.up, hVelocity); 516 | return Vector3.Cross(sideways, groundNormal).normalized * hVelocity.magnitude; 517 | } 518 | 519 | private function IsGroundedTest () { 520 | return (groundNormal.y > 0.01); 521 | } 522 | 523 | function GetMaxAcceleration (grounded : boolean) : float { 524 | // Maximum acceleration on ground and in air 525 | if (grounded) 526 | return movement.maxGroundAcceleration; 527 | else 528 | return movement.maxAirAcceleration; 529 | } 530 | 531 | function CalculateJumpVerticalSpeed (targetJumpHeight : float) { 532 | // From the jump height and gravity we deduce the upwards speed 533 | // for the character to reach at the apex. 534 | return Mathf.Sqrt (2 * targetJumpHeight * movement.gravity); 535 | } 536 | 537 | function IsJumping () { 538 | return jumping.jumping; 539 | } 540 | 541 | function IsSliding () { 542 | return (grounded && sliding.enabled && TooSteep()); 543 | } 544 | 545 | function IsTouchingCeiling () { 546 | return (movement.collisionFlags & CollisionFlags.CollidedAbove) != 0; 547 | } 548 | 549 | function IsGrounded () { 550 | return grounded; 551 | } 552 | 553 | function TooSteep () { 554 | return (groundNormal.y <= Mathf.Cos(controller.slopeLimit * Mathf.Deg2Rad)); 555 | } 556 | 557 | function GetDirection () { 558 | return inputMoveDirection; 559 | } 560 | 561 | function SetControllable (controllable : boolean) { 562 | canControl = controllable; 563 | } 564 | 565 | // Project a direction onto elliptical quater segments based on forward, sideways, and backwards speed. 566 | // The function returns the length of the resulting vector. 567 | function MaxSpeedInDirection (desiredMovementDirection : Vector3) : float { 568 | if (desiredMovementDirection == Vector3.zero) 569 | return 0; 570 | else { 571 | var zAxisEllipseMultiplier : float = (desiredMovementDirection.z > 0 ? movement.maxForwardSpeed : movement.maxBackwardsSpeed) / movement.maxSidewaysSpeed; 572 | var temp : Vector3 = new Vector3(desiredMovementDirection.x, 0, desiredMovementDirection.z / zAxisEllipseMultiplier).normalized; 573 | var length : float = new Vector3(temp.x, 0, temp.z * zAxisEllipseMultiplier).magnitude * movement.maxSidewaysSpeed; 574 | return length; 575 | } 576 | } 577 | 578 | function SetVelocity (velocity : Vector3) { 579 | grounded = false; 580 | movement.velocity = velocity; 581 | movement.frameVelocity = Vector3.zero; 582 | SendMessage("OnExternalVelocity"); 583 | } 584 | 585 | // Require a character controller to be attached to the same game object 586 | @script RequireComponent (CharacterController) 587 | @script AddComponentMenu ("Character/Character Motor") 588 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ab79d7f243824f5d9826bd83522c8df 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/FPSInputController.js: -------------------------------------------------------------------------------- 1 | private var motor : CharacterMotor; 2 | 3 | // Use this for initialization 4 | function Awake () { 5 | motor = GetComponent(CharacterMotor); 6 | } 7 | 8 | // Update is called once per frame 9 | function Update () { 10 | // Get the input vector from keyboard or analog stick 11 | var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); 12 | 13 | if (directionVector != Vector3.zero) { 14 | // Get the length of the directon vector and then normalize it 15 | // Dividing by the length is cheaper than normalizing when we already have the length anyway 16 | var directionLength = directionVector.magnitude; 17 | directionVector = directionVector / directionLength; 18 | 19 | // Make sure the length is no bigger than 1 20 | directionLength = Mathf.Min(1, directionLength); 21 | 22 | // Make the input vector more sensitive towards the extremes and less sensitive in the middle 23 | // This makes it easier to control slow speeds when using analog sticks 24 | directionLength = directionLength * directionLength; 25 | 26 | // Multiply the normalized direction vector by the modified length 27 | directionVector = directionVector * directionLength; 28 | } 29 | 30 | // Apply the direction to the CharacterMotor 31 | motor.inputMoveDirection = transform.rotation * directionVector; 32 | motor.inputJump = Input.GetButton("Jump"); 33 | } 34 | 35 | // Require a character controller to be attached to the same game object 36 | @script RequireComponent (CharacterMotor) 37 | @script AddComponentMenu ("Character/FPS Input Controller") 38 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/FPSInputController.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60bca8f58a0b8478e946e6e86658cb29 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/MouseLook.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | /// MouseLook rotates the transform based on the mouse delta. 5 | /// Minimum and Maximum values can be used to constrain the possible rotation 6 | 7 | /// To make an FPS style character: 8 | /// - Create a capsule. 9 | /// - Add the MouseLook script to the capsule. 10 | /// -> Set the mouse look to use LookX. (You want to only turn character but not tilt it) 11 | /// - Add FPSInputController script to the capsule 12 | /// -> A CharacterMotor and a CharacterController component will be automatically added. 13 | 14 | /// - Create a camera. Make the camera a child of the capsule. Reset it's transform. 15 | /// - Add a MouseLook script to the camera. 16 | /// -> Set the mouse look to use LookY. (You want the camera to tilt up and down like a head. The character already turns.) 17 | [AddComponentMenu("Camera-Control/Mouse Look")] 18 | public class MouseLook : MonoBehaviour { 19 | 20 | public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 } 21 | public RotationAxes axes = RotationAxes.MouseXAndY; 22 | public float sensitivityX = 15F; 23 | public float sensitivityY = 15F; 24 | 25 | public float minimumX = -360F; 26 | public float maximumX = 360F; 27 | 28 | public float minimumY = -60F; 29 | public float maximumY = 60F; 30 | 31 | float rotationY = 0F; 32 | 33 | void Update () 34 | { 35 | if (axes == RotationAxes.MouseXAndY) 36 | { 37 | float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX; 38 | 39 | rotationY += Input.GetAxis("Mouse Y") * sensitivityY; 40 | rotationY = Mathf.Clamp (rotationY, minimumY, maximumY); 41 | 42 | transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); 43 | } 44 | else if (axes == RotationAxes.MouseX) 45 | { 46 | transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0); 47 | } 48 | else 49 | { 50 | rotationY += Input.GetAxis("Mouse Y") * sensitivityY; 51 | rotationY = Mathf.Clamp (rotationY, minimumY, maximumY); 52 | 53 | transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0); 54 | } 55 | } 56 | 57 | void Start () 58 | { 59 | // Make the rigid body not change rotation 60 | if (GetComponent()) 61 | GetComponent().freezeRotation = true; 62 | } 63 | } -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/MouseLook.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68ec2fe99d1108b9d0006a298d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/PlatformInputController.js: -------------------------------------------------------------------------------- 1 | // This makes the character turn to face the current movement speed per default. 2 | var autoRotate : boolean = true; 3 | var maxRotationSpeed : float = 360; 4 | 5 | private var motor : CharacterMotor; 6 | 7 | // Use this for initialization 8 | function Awake () { 9 | motor = GetComponent(CharacterMotor); 10 | } 11 | 12 | // Update is called once per frame 13 | function Update () { 14 | // Get the input vector from keyboard or analog stick 15 | var directionVector = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0); 16 | 17 | if (directionVector != Vector3.zero) { 18 | // Get the length of the directon vector and then normalize it 19 | // Dividing by the length is cheaper than normalizing when we already have the length anyway 20 | var directionLength = directionVector.magnitude; 21 | directionVector = directionVector / directionLength; 22 | 23 | // Make sure the length is no bigger than 1 24 | directionLength = Mathf.Min(1, directionLength); 25 | 26 | // Make the input vector more sensitive towards the extremes and less sensitive in the middle 27 | // This makes it easier to control slow speeds when using analog sticks 28 | directionLength = directionLength * directionLength; 29 | 30 | // Multiply the normalized direction vector by the modified length 31 | directionVector = directionVector * directionLength; 32 | } 33 | 34 | // Rotate the input vector into camera space so up is camera's up and right is camera's right 35 | directionVector = Camera.main.transform.rotation * directionVector; 36 | 37 | // Rotate input vector to be perpendicular to character's up vector 38 | var camToCharacterSpace = Quaternion.FromToRotation(-Camera.main.transform.forward, transform.up); 39 | directionVector = (camToCharacterSpace * directionVector); 40 | 41 | // Apply the direction to the CharacterMotor 42 | motor.inputMoveDirection = directionVector; 43 | motor.inputJump = Input.GetButton("Jump"); 44 | 45 | // Set rotation to the move direction 46 | if (autoRotate && directionVector.sqrMagnitude > 0.01) { 47 | var newForward : Vector3 = ConstantSlerp( 48 | transform.forward, 49 | directionVector, 50 | maxRotationSpeed * Time.deltaTime 51 | ); 52 | newForward = ProjectOntoPlane(newForward, transform.up); 53 | transform.rotation = Quaternion.LookRotation(newForward, transform.up); 54 | } 55 | } 56 | 57 | function ProjectOntoPlane (v : Vector3, normal : Vector3) { 58 | return v - Vector3.Project(v, normal); 59 | } 60 | 61 | function ConstantSlerp (from : Vector3, to : Vector3, angle : float) { 62 | var value : float = Mathf.Min(1, angle / Vector3.Angle(from, to)); 63 | return Vector3.Slerp(from, to, value); 64 | } 65 | 66 | // Require a character controller to be attached to the same game object 67 | @script RequireComponent (CharacterMotor) 68 | @script AddComponentMenu ("Character/Platform Input Controller") 69 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/PlatformInputController.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da93ddd6928094e24bb1f3f665f143d3 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonCamera.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var cameraTransform : Transform; 4 | private var _target : Transform; 5 | 6 | // The distance in the x-z plane to the target 7 | 8 | var distance = 7.0; 9 | 10 | // the height we want the camera to be above the target 11 | var height = 3.0; 12 | 13 | var angularSmoothLag = 0.3; 14 | var angularMaxSpeed = 15.0; 15 | 16 | var heightSmoothLag = 0.3; 17 | 18 | var snapSmoothLag = 0.2; 19 | var snapMaxSpeed = 720.0; 20 | 21 | var clampHeadPositionScreenSpace = 0.75; 22 | 23 | var lockCameraTimeout = 0.2; 24 | 25 | private var headOffset = Vector3.zero; 26 | private var centerOffset = Vector3.zero; 27 | 28 | private var heightVelocity = 0.0; 29 | private var angleVelocity = 0.0; 30 | private var snap = false; 31 | private var controller : ThirdPersonController; 32 | private var targetHeight = 100000.0; 33 | 34 | function Awake () 35 | { 36 | if(!cameraTransform && Camera.main) 37 | cameraTransform = Camera.main.transform; 38 | if(!cameraTransform) { 39 | Debug.Log("Please assign a camera to the ThirdPersonCamera script."); 40 | enabled = false; 41 | } 42 | 43 | 44 | _target = transform; 45 | if (_target) 46 | { 47 | controller = _target.GetComponent(ThirdPersonController); 48 | } 49 | 50 | if (controller) 51 | { 52 | var characterController : CharacterController = _target.GetComponent.(); 53 | centerOffset = characterController.bounds.center - _target.position; 54 | headOffset = centerOffset; 55 | headOffset.y = characterController.bounds.max.y - _target.position.y; 56 | } 57 | else 58 | Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached."); 59 | 60 | 61 | Cut(_target, centerOffset); 62 | } 63 | 64 | function DebugDrawStuff () 65 | { 66 | Debug.DrawLine(_target.position, _target.position + headOffset); 67 | 68 | } 69 | 70 | function AngleDistance (a : float, b : float) 71 | { 72 | a = Mathf.Repeat(a, 360); 73 | b = Mathf.Repeat(b, 360); 74 | 75 | return Mathf.Abs(b - a); 76 | } 77 | 78 | function Apply (dummyTarget : Transform, dummyCenter : Vector3) 79 | { 80 | // Early out if we don't have a target 81 | if (!controller) 82 | return; 83 | 84 | var targetCenter = _target.position + centerOffset; 85 | var targetHead = _target.position + headOffset; 86 | 87 | // DebugDrawStuff(); 88 | 89 | // Calculate the current & target rotation angles 90 | var originalTargetAngle = _target.eulerAngles.y; 91 | var currentAngle = cameraTransform.eulerAngles.y; 92 | 93 | // Adjust real target angle when camera is locked 94 | var targetAngle = originalTargetAngle; 95 | 96 | // When pressing Fire2 (alt) the camera will snap to the target direction real quick. 97 | // It will stop snapping when it reaches the target 98 | if (Input.GetButton("Fire2")) 99 | snap = true; 100 | 101 | if (snap) 102 | { 103 | // We are close to the target, so we can stop snapping now! 104 | if (AngleDistance (currentAngle, originalTargetAngle) < 3.0) 105 | snap = false; 106 | 107 | currentAngle = Mathf.SmoothDampAngle(currentAngle, targetAngle, angleVelocity, snapSmoothLag, snapMaxSpeed); 108 | } 109 | // Normal camera motion 110 | else 111 | { 112 | if (controller.GetLockCameraTimer () < lockCameraTimeout) 113 | { 114 | targetAngle = currentAngle; 115 | } 116 | 117 | // Lock the camera when moving backwards! 118 | // * It is really confusing to do 180 degree spins when turning around. 119 | if (AngleDistance (currentAngle, targetAngle) > 160 && controller.IsMovingBackwards ()) 120 | targetAngle += 180; 121 | 122 | currentAngle = Mathf.SmoothDampAngle(currentAngle, targetAngle, angleVelocity, angularSmoothLag, angularMaxSpeed); 123 | } 124 | 125 | 126 | // When jumping don't move camera upwards but only down! 127 | if (controller.IsJumping ()) 128 | { 129 | // We'd be moving the camera upwards, do that only if it's really high 130 | var newTargetHeight = targetCenter.y + height; 131 | if (newTargetHeight < targetHeight || newTargetHeight - targetHeight > 5) 132 | targetHeight = targetCenter.y + height; 133 | } 134 | // When walking always update the target height 135 | else 136 | { 137 | targetHeight = targetCenter.y + height; 138 | } 139 | 140 | // Damp the height 141 | var currentHeight = cameraTransform.position.y; 142 | currentHeight = Mathf.SmoothDamp (currentHeight, targetHeight, heightVelocity, heightSmoothLag); 143 | 144 | // Convert the angle into a rotation, by which we then reposition the camera 145 | var currentRotation = Quaternion.Euler (0, currentAngle, 0); 146 | 147 | // Set the position of the camera on the x-z plane to: 148 | // distance meters behind the target 149 | cameraTransform.position = targetCenter; 150 | cameraTransform.position += currentRotation * Vector3.back * distance; 151 | 152 | // Set the height of the camera 153 | cameraTransform.position.y = currentHeight; 154 | 155 | // Always look at the target 156 | SetUpRotation(targetCenter, targetHead); 157 | } 158 | 159 | function LateUpdate () { 160 | Apply (transform, Vector3.zero); 161 | } 162 | 163 | function Cut (dummyTarget : Transform, dummyCenter : Vector3) 164 | { 165 | var oldHeightSmooth = heightSmoothLag; 166 | var oldSnapMaxSpeed = snapMaxSpeed; 167 | var oldSnapSmooth = snapSmoothLag; 168 | 169 | snapMaxSpeed = 10000; 170 | snapSmoothLag = 0.001; 171 | heightSmoothLag = 0.001; 172 | 173 | snap = true; 174 | Apply (transform, Vector3.zero); 175 | 176 | heightSmoothLag = oldHeightSmooth; 177 | snapMaxSpeed = oldSnapMaxSpeed; 178 | snapSmoothLag = oldSnapSmooth; 179 | } 180 | 181 | function SetUpRotation (centerPos : Vector3, headPos : Vector3) 182 | { 183 | // Now it's getting hairy. The devil is in the details here, the big issue is jumping of course. 184 | // * When jumping up and down we don't want to center the guy in screen space. 185 | // This is important to give a feel for how high you jump and avoiding large camera movements. 186 | // 187 | // * At the same time we dont want him to ever go out of screen and we want all rotations to be totally smooth. 188 | // 189 | // So here is what we will do: 190 | // 191 | // 1. We first find the rotation around the y axis. Thus he is always centered on the y-axis 192 | // 2. When grounded we make him be centered 193 | // 3. When jumping we keep the camera rotation but rotate the camera to get him back into view if his head is above some threshold 194 | // 4. When landing we smoothly interpolate towards centering him on screen 195 | var cameraPos = cameraTransform.position; 196 | var offsetToCenter = centerPos - cameraPos; 197 | 198 | // Generate base rotation only around y-axis 199 | var yRotation = Quaternion.LookRotation(Vector3(offsetToCenter.x, 0, offsetToCenter.z)); 200 | 201 | var relativeOffset = Vector3.forward * distance + Vector3.down * height; 202 | cameraTransform.rotation = yRotation * Quaternion.LookRotation(relativeOffset); 203 | 204 | // Calculate the projected center position and top position in world space 205 | var centerRay = cameraTransform.GetComponent.().ViewportPointToRay(Vector3(.5, 0.5, 1)); 206 | var topRay = cameraTransform.GetComponent.().ViewportPointToRay(Vector3(.5, clampHeadPositionScreenSpace, 1)); 207 | 208 | var centerRayPos = centerRay.GetPoint(distance); 209 | var topRayPos = topRay.GetPoint(distance); 210 | 211 | var centerToTopAngle = Vector3.Angle(centerRay.direction, topRay.direction); 212 | 213 | var heightToAngle = centerToTopAngle / (centerRayPos.y - topRayPos.y); 214 | 215 | var extraLookAngle = heightToAngle * (centerRayPos.y - centerPos.y); 216 | if (extraLookAngle < centerToTopAngle) 217 | { 218 | extraLookAngle = 0; 219 | } 220 | else 221 | { 222 | extraLookAngle = extraLookAngle - centerToTopAngle; 223 | cameraTransform.rotation *= Quaternion.Euler(-extraLookAngle, 0, 0); 224 | } 225 | } 226 | 227 | function GetCenterOffset () 228 | { 229 | return centerOffset; 230 | } 231 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonCamera.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b167d00b3108411a8a963cba5ddde1b 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonController.js: -------------------------------------------------------------------------------- 1 | 2 | // Require a character controller to be attached to the same game object 3 | @script RequireComponent(CharacterController) 4 | 5 | public var idleAnimation : AnimationClip; 6 | public var walkAnimation : AnimationClip; 7 | public var runAnimation : AnimationClip; 8 | public var jumpPoseAnimation : AnimationClip; 9 | 10 | public var walkMaxAnimationSpeed : float = 0.75; 11 | public var trotMaxAnimationSpeed : float = 1.0; 12 | public var runMaxAnimationSpeed : float = 1.0; 13 | public var jumpAnimationSpeed : float = 1.15; 14 | public var landAnimationSpeed : float = 1.0; 15 | 16 | private var _animation : Animation; 17 | 18 | enum CharacterState { 19 | Idle = 0, 20 | Walking = 1, 21 | Trotting = 2, 22 | Running = 3, 23 | Jumping = 4, 24 | } 25 | 26 | private var _characterState : CharacterState; 27 | 28 | // The speed when walking 29 | var walkSpeed = 2.0; 30 | // after trotAfterSeconds of walking we trot with trotSpeed 31 | var trotSpeed = 4.0; 32 | // when pressing "Fire3" button (cmd) we start running 33 | var runSpeed = 6.0; 34 | 35 | var inAirControlAcceleration = 3.0; 36 | 37 | // How high do we jump when pressing jump and letting go immediately 38 | var jumpHeight = 0.5; 39 | 40 | // The gravity for the character 41 | var gravity = 20.0; 42 | // The gravity in controlled descent mode 43 | var speedSmoothing = 10.0; 44 | var rotateSpeed = 500.0; 45 | var trotAfterSeconds = 3.0; 46 | 47 | var canJump = true; 48 | 49 | private var jumpRepeatTime = 0.05; 50 | private var jumpTimeout = 0.15; 51 | private var groundedTimeout = 0.25; 52 | 53 | // The camera doesnt start following the target immediately but waits for a split second to avoid too much waving around. 54 | private var lockCameraTimer = 0.0; 55 | 56 | // The current move direction in x-z 57 | private var moveDirection = Vector3.zero; 58 | // The current vertical speed 59 | private var verticalSpeed = 0.0; 60 | // The current x-z move speed 61 | private var moveSpeed = 0.0; 62 | 63 | // The last collision flags returned from controller.Move 64 | private var collisionFlags : CollisionFlags; 65 | 66 | // Are we jumping? (Initiated with jump button and not grounded yet) 67 | private var jumping = false; 68 | private var jumpingReachedApex = false; 69 | 70 | // Are we moving backwards (This locks the camera to not do a 180 degree spin) 71 | private var movingBack = false; 72 | // Is the user pressing any keys? 73 | private var isMoving = false; 74 | // When did the user start walking (Used for going into trot after a while) 75 | private var walkTimeStart = 0.0; 76 | // Last time the jump button was clicked down 77 | private var lastJumpButtonTime = -10.0; 78 | // Last time we performed a jump 79 | private var lastJumpTime = -1.0; 80 | 81 | 82 | // the height we jumped from (Used to determine for how long to apply extra jump power after jumping.) 83 | private var lastJumpStartHeight = 0.0; 84 | 85 | 86 | private var inAirVelocity = Vector3.zero; 87 | 88 | private var lastGroundedTime = 0.0; 89 | 90 | 91 | private var isControllable = true; 92 | 93 | function Awake () 94 | { 95 | moveDirection = transform.TransformDirection(Vector3.forward); 96 | 97 | _animation = GetComponent(Animation); 98 | if(!_animation) 99 | Debug.Log("The character you would like to control doesn't have animations. Moving her might look weird."); 100 | 101 | /* 102 | public var idleAnimation : AnimationClip; 103 | public var walkAnimation : AnimationClip; 104 | public var runAnimation : AnimationClip; 105 | public var jumpPoseAnimation : AnimationClip; 106 | */ 107 | if(!idleAnimation) { 108 | _animation = null; 109 | Debug.Log("No idle animation found. Turning off animations."); 110 | } 111 | if(!walkAnimation) { 112 | _animation = null; 113 | Debug.Log("No walk animation found. Turning off animations."); 114 | } 115 | if(!runAnimation) { 116 | _animation = null; 117 | Debug.Log("No run animation found. Turning off animations."); 118 | } 119 | if(!jumpPoseAnimation && canJump) { 120 | _animation = null; 121 | Debug.Log("No jump animation found and the character has canJump enabled. Turning off animations."); 122 | } 123 | 124 | } 125 | 126 | 127 | function UpdateSmoothedMovementDirection () 128 | { 129 | var cameraTransform = Camera.main.transform; 130 | var grounded = IsGrounded(); 131 | 132 | // Forward vector relative to the camera along the x-z plane 133 | var forward = cameraTransform.TransformDirection(Vector3.forward); 134 | forward.y = 0; 135 | forward = forward.normalized; 136 | 137 | // Right vector relative to the camera 138 | // Always orthogonal to the forward vector 139 | var right = Vector3(forward.z, 0, -forward.x); 140 | 141 | var v = Input.GetAxisRaw("Vertical"); 142 | var h = Input.GetAxisRaw("Horizontal"); 143 | 144 | // Are we moving backwards or looking backwards 145 | if (v < -0.2) 146 | movingBack = true; 147 | else 148 | movingBack = false; 149 | 150 | var wasMoving = isMoving; 151 | isMoving = Mathf.Abs (h) > 0.1 || Mathf.Abs (v) > 0.1; 152 | 153 | // Target direction relative to the camera 154 | var targetDirection = h * right + v * forward; 155 | 156 | // Grounded controls 157 | if (grounded) 158 | { 159 | // Lock camera for short period when transitioning moving & standing still 160 | lockCameraTimer += Time.deltaTime; 161 | if (isMoving != wasMoving) 162 | lockCameraTimer = 0.0; 163 | 164 | // We store speed and direction seperately, 165 | // so that when the character stands still we still have a valid forward direction 166 | // moveDirection is always normalized, and we only update it if there is user input. 167 | if (targetDirection != Vector3.zero) 168 | { 169 | // If we are really slow, just snap to the target direction 170 | if (moveSpeed < walkSpeed * 0.9 && grounded) 171 | { 172 | moveDirection = targetDirection.normalized; 173 | } 174 | // Otherwise smoothly turn towards it 175 | else 176 | { 177 | moveDirection = Vector3.RotateTowards(moveDirection, targetDirection, rotateSpeed * Mathf.Deg2Rad * Time.deltaTime, 1000); 178 | 179 | moveDirection = moveDirection.normalized; 180 | } 181 | } 182 | 183 | // Smooth the speed based on the current target direction 184 | var curSmooth = speedSmoothing * Time.deltaTime; 185 | 186 | // Choose target speed 187 | //* We want to support analog input but make sure you cant walk faster diagonally than just forward or sideways 188 | var targetSpeed = Mathf.Min(targetDirection.magnitude, 1.0); 189 | 190 | _characterState = CharacterState.Idle; 191 | 192 | // Pick speed modifier 193 | if (Input.GetKey (KeyCode.LeftShift) || Input.GetKey (KeyCode.RightShift)) 194 | { 195 | targetSpeed *= runSpeed; 196 | _characterState = CharacterState.Running; 197 | } 198 | else if (Time.time - trotAfterSeconds > walkTimeStart) 199 | { 200 | targetSpeed *= trotSpeed; 201 | _characterState = CharacterState.Trotting; 202 | } 203 | else 204 | { 205 | targetSpeed *= walkSpeed; 206 | _characterState = CharacterState.Walking; 207 | } 208 | 209 | moveSpeed = Mathf.Lerp(moveSpeed, targetSpeed, curSmooth); 210 | 211 | // Reset walk time start when we slow down 212 | if (moveSpeed < walkSpeed * 0.3) 213 | walkTimeStart = Time.time; 214 | } 215 | // In air controls 216 | else 217 | { 218 | // Lock camera while in air 219 | if (jumping) 220 | lockCameraTimer = 0.0; 221 | 222 | if (isMoving) 223 | inAirVelocity += targetDirection.normalized * Time.deltaTime * inAirControlAcceleration; 224 | } 225 | 226 | 227 | 228 | } 229 | 230 | 231 | function ApplyJumping () 232 | { 233 | // Prevent jumping too fast after each other 234 | if (lastJumpTime + jumpRepeatTime > Time.time) 235 | return; 236 | 237 | if (IsGrounded()) { 238 | // Jump 239 | // - Only when pressing the button down 240 | // - With a timeout so you can press the button slightly before landing 241 | if (canJump && Time.time < lastJumpButtonTime + jumpTimeout) { 242 | verticalSpeed = CalculateJumpVerticalSpeed (jumpHeight); 243 | SendMessage("DidJump", SendMessageOptions.DontRequireReceiver); 244 | } 245 | } 246 | } 247 | 248 | 249 | function ApplyGravity () 250 | { 251 | if (isControllable) // don't move player at all if not controllable. 252 | { 253 | // Apply gravity 254 | var jumpButton = Input.GetButton("Jump"); 255 | 256 | 257 | // When we reach the apex of the jump we send out a message 258 | if (jumping && !jumpingReachedApex && verticalSpeed <= 0.0) 259 | { 260 | jumpingReachedApex = true; 261 | SendMessage("DidJumpReachApex", SendMessageOptions.DontRequireReceiver); 262 | } 263 | 264 | if (IsGrounded ()) 265 | verticalSpeed = 0.0; 266 | else 267 | verticalSpeed -= gravity * Time.deltaTime; 268 | } 269 | } 270 | 271 | function CalculateJumpVerticalSpeed (targetJumpHeight : float) 272 | { 273 | // From the jump height and gravity we deduce the upwards speed 274 | // for the character to reach at the apex. 275 | return Mathf.Sqrt(2 * targetJumpHeight * gravity); 276 | } 277 | 278 | function DidJump () 279 | { 280 | jumping = true; 281 | jumpingReachedApex = false; 282 | lastJumpTime = Time.time; 283 | lastJumpStartHeight = transform.position.y; 284 | lastJumpButtonTime = -10; 285 | 286 | _characterState = CharacterState.Jumping; 287 | } 288 | 289 | function Update() { 290 | 291 | if (!isControllable) 292 | { 293 | // kill all inputs if not controllable. 294 | Input.ResetInputAxes(); 295 | } 296 | 297 | if (Input.GetButtonDown ("Jump")) 298 | { 299 | lastJumpButtonTime = Time.time; 300 | } 301 | 302 | UpdateSmoothedMovementDirection(); 303 | 304 | // Apply gravity 305 | // - extra power jump modifies gravity 306 | // - controlledDescent mode modifies gravity 307 | ApplyGravity (); 308 | 309 | // Apply jumping logic 310 | ApplyJumping (); 311 | 312 | // Calculate actual motion 313 | var movement = moveDirection * moveSpeed + Vector3 (0, verticalSpeed, 0) + inAirVelocity; 314 | movement *= Time.deltaTime; 315 | 316 | // Move the controller 317 | var controller : CharacterController = GetComponent(CharacterController); 318 | collisionFlags = controller.Move(movement); 319 | 320 | // ANIMATION sector 321 | if(_animation) { 322 | if(_characterState == CharacterState.Jumping) 323 | { 324 | if(!jumpingReachedApex) { 325 | _animation[jumpPoseAnimation.name].speed = jumpAnimationSpeed; 326 | _animation[jumpPoseAnimation.name].wrapMode = WrapMode.ClampForever; 327 | _animation.CrossFade(jumpPoseAnimation.name); 328 | } else { 329 | _animation[jumpPoseAnimation.name].speed = -landAnimationSpeed; 330 | _animation[jumpPoseAnimation.name].wrapMode = WrapMode.ClampForever; 331 | _animation.CrossFade(jumpPoseAnimation.name); 332 | } 333 | } 334 | else 335 | { 336 | if(controller.velocity.sqrMagnitude < 0.1) { 337 | _animation.CrossFade(idleAnimation.name); 338 | } 339 | else 340 | { 341 | if(_characterState == CharacterState.Running) { 342 | _animation[runAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, runMaxAnimationSpeed); 343 | _animation.CrossFade(runAnimation.name); 344 | } 345 | else if(_characterState == CharacterState.Trotting) { 346 | _animation[walkAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, trotMaxAnimationSpeed); 347 | _animation.CrossFade(walkAnimation.name); 348 | } 349 | else if(_characterState == CharacterState.Walking) { 350 | _animation[walkAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, walkMaxAnimationSpeed); 351 | _animation.CrossFade(walkAnimation.name); 352 | } 353 | 354 | } 355 | } 356 | } 357 | // ANIMATION sector 358 | 359 | // Set rotation to the move direction 360 | if (IsGrounded()) 361 | { 362 | 363 | transform.rotation = Quaternion.LookRotation(moveDirection); 364 | 365 | } 366 | else 367 | { 368 | var xzMove = movement; 369 | xzMove.y = 0; 370 | if (xzMove.sqrMagnitude > 0.001) 371 | { 372 | transform.rotation = Quaternion.LookRotation(xzMove); 373 | } 374 | } 375 | 376 | // We are in jump mode but just became grounded 377 | if (IsGrounded()) 378 | { 379 | lastGroundedTime = Time.time; 380 | inAirVelocity = Vector3.zero; 381 | if (jumping) 382 | { 383 | jumping = false; 384 | SendMessage("DidLand", SendMessageOptions.DontRequireReceiver); 385 | } 386 | } 387 | } 388 | 389 | function OnControllerColliderHit (hit : ControllerColliderHit ) 390 | { 391 | // Debug.DrawRay(hit.point, hit.normal); 392 | if (hit.moveDirection.y > 0.01) 393 | return; 394 | } 395 | 396 | function GetSpeed () { 397 | return moveSpeed; 398 | } 399 | 400 | function IsJumping () { 401 | return jumping; 402 | } 403 | 404 | function IsGrounded () { 405 | return (collisionFlags & CollisionFlags.CollidedBelow) != 0; 406 | } 407 | 408 | function GetDirection () { 409 | return moveDirection; 410 | } 411 | 412 | function IsMovingBackwards () { 413 | return movingBack; 414 | } 415 | 416 | function GetLockCameraTimer () 417 | { 418 | return lockCameraTimer; 419 | } 420 | 421 | function IsMoving () : boolean 422 | { 423 | return Mathf.Abs(Input.GetAxisRaw("Vertical")) + Mathf.Abs(Input.GetAxisRaw("Horizontal")) > 0.5; 424 | } 425 | 426 | function HasJumpReachedApex () 427 | { 428 | return jumpingReachedApex; 429 | } 430 | 431 | function IsGroundedWithTimeout () 432 | { 433 | return lastGroundedTime + groundedTimeout > Time.time; 434 | } 435 | 436 | function Reset () 437 | { 438 | gameObject.tag = "Player"; 439 | } 440 | 441 | -------------------------------------------------------------------------------- /Assets/Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonController.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d5ac211a643e447ca78c2d794a16381 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Example-Scene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/Example-Scene.unity -------------------------------------------------------------------------------- /Assets/Example-Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e2bd09fcbcbf4e5ab96a6f968603800 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/MirrorReflection.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae8f5e774211995429e1a2a3e8c04ac1 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/MirrorReflection/MirrorReflection.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/MirrorReflection/MirrorReflection.cs -------------------------------------------------------------------------------- /Assets/MirrorReflection/MirrorReflection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee074980bfd3b4d1cb8db84389844e4d 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/MirrorReflection/MirrorReflection.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/MirrorReflection/MirrorReflection.mat -------------------------------------------------------------------------------- /Assets/MirrorReflection/MirrorReflection.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8fc4ad306d6304feb91175343acc0b85 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/MirrorReflection/MirrorReflection.shader: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/Assets/MirrorReflection/MirrorReflection.shader -------------------------------------------------------------------------------- /Assets/MirrorReflection/MirrorReflection.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b94491f50f9cf48c6b8afb258ac75de0 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QianMo/Unity-Mirror-Reflection-Example/ab4108430e560031554e957e7d9bcbf715ee89fa/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 中文版说明 2 | ==================================== 3 | ### Unity3D镜面反射实现示例 4 | 此项目用Shader配合C#脚本,实现了Unity3D中简单的镜面反射效果。 5 | ![](http://img.blog.csdn.net/20150327104450257) 6 | Unity3D运行效果图 7 | 8 |

9 | English language Edition 10 | ===================================== 11 | ###Unity3D Mirror Reflection Example 12 | This project uses Shader and the C# script, implements a simple specular reflection effect in Unity3D. 13 | ![](http://img.blog.csdn.net/20150327104450257) 14 | Unity3D screenshot 15 | --------------------------------------------------------------------------------