diff --git a/Assets/Materials.meta b/Assets/Materials.meta new file mode 100644 index 0000000..3e95029 --- /dev/null +++ b/Assets/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3b058ef37cff8514ea88dbde5a77d8ac +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Temp2.mat b/Assets/Materials/Temp2.mat new file mode 100644 index 0000000..22d67cc --- /dev/null +++ b/Assets/Materials/Temp2.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Temp2 + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 0, b: 0.8893652, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Materials/Temp2.mat.meta b/Assets/Materials/Temp2.mat.meta new file mode 100644 index 0000000..f3546b3 --- /dev/null +++ b/Assets/Materials/Temp2.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 950d424518c282344956b5e374c7b715 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/TempMaterial.mat b/Assets/Materials/TempMaterial.mat new file mode 100644 index 0000000..517586b --- /dev/null +++ b/Assets/Materials/TempMaterial.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TempMaterial + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.9339623, g: 0.013216423, b: 0.013216423, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Materials/TempMaterial.mat.meta b/Assets/Materials/TempMaterial.mat.meta new file mode 100644 index 0000000..37545b0 --- /dev/null +++ b/Assets/Materials/TempMaterial.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d928d9af1f7c5214a99493df063dbf36 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index e9f774f..9d74155 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -121,89 +121,99 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1001 &459896632 -PrefabInstance: +--- !u!1 &380641380 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 380641384} + - component: {fileID: 380641383} + - component: {fileID: 380641382} + - component: {fileID: 380641381} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &380641381 +BoxCollider: m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 380641380} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 1975754340} - m_Modifications: - - target: {fileID: 588491153375435794, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_Name - value: Cube - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: - - {fileID: -641725564868193174, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} - - {fileID: 6187295151528677371, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} - m_SourcePrefab: {fileID: 100100000, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} ---- !u!1 &459896633 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 588491153375435794, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - m_PrefabInstance: {fileID: 459896632} + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &380641382 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} ---- !u!4 &459896634 stripped + m_GameObject: {fileID: 380641380} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: d928d9af1f7c5214a99493df063dbf36, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &380641383 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 380641380} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &380641384 Transform: - m_CorrespondingSourceObject: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - m_PrefabInstance: {fileID: 459896632} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 380641380} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.8334109, y: -6.424332, z: 13.56534} + m_LocalScale: {x: 46.966, y: 1, z: 56.905} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -296,6 +306,99 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &778362041 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 778362045} + - component: {fileID: 778362044} + - component: {fileID: 778362043} + - component: {fileID: 778362042} + m_Layer: 0 + m_Name: Cube (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &778362042 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778362041} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &778362043 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778362041} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 950d424518c282344956b5e374c7b715, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &778362044 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778362041} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &778362045 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778362041} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.8334109, y: 0.2, z: 27.1} + m_LocalScale: {x: 44.013, y: 16.279, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &963194225 GameObject: m_ObjectHideFlags: 0 @@ -372,13 +475,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 963194225} - m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 15.53, z: -1.4} + m_LocalRotation: {x: 0.38268343, y: 0, z: 0, w: 0.92387956} + m_LocalPosition: {x: 0, y: 18.26, z: -16.88} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0} --- !u!1 &1457452758 GameObject: m_ObjectHideFlags: 0 @@ -440,7 +543,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 98ac8f1294983784896047d8a4f215cc, type: 3} m_Name: m_EditorClassIdentifier: - Prefab: {fileID: 1975754334} + Prefab: {fileID: 7371939184051845554, guid: f5c2c9744b6f46e4e95ca41ab1d8d560, type: 3} HerdCount: 20 SpawnPoint: {fileID: 0} WaitTime: 0.2 @@ -452,74 +555,9 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1457452758} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.3643858, y: 0.05262532, z: 0.9637832} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1975754334 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1975754340} - - component: {fileID: 1975754336} - - component: {fileID: 1975754335} - m_Layer: 0 - m_Name: Horse - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!143 &1975754335 -CharacterController: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1975754334} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Height: 2 - m_Radius: 1 - m_SlopeLimit: 45 - m_StepOffset: 0.3 - m_SkinWidth: 0.08 - m_MinMoveDistance: 0.001 - m_Center: {x: 0, y: 1, z: 0} ---- !u!114 &1975754336 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1975754334} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8f7fbcfa6410c204e8977bb70e5ff84b, type: 3} - m_Name: - m_EditorClassIdentifier: - walkSpeed: 2 - model: {fileID: 459896633} ---- !u!4 &1975754340 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1975754334} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 459896634} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/Input/DynamicCamera.cs b/Assets/Scripts/Input/DynamicCamera.cs index 6a58fae..41ceaf5 100644 --- a/Assets/Scripts/Input/DynamicCamera.cs +++ b/Assets/Scripts/Input/DynamicCamera.cs @@ -4,17 +4,20 @@ using UnityEngine; public class NewBehaviourScript : MonoBehaviour { - public GameObject Target; + public GameObject target; + public float camHeight; - // Start is called before the first frame update - void Start() + void Follow() { - + Vector3 tempDest = target.transform.position; + tempDest.y = camHeight; + Vector3 destination = Vector3.Lerp(transform.position, tempDest, 1); + transform.position = destination; } // Update is called once per frame - void Update() + void FixedUpdate() { - + Follow(); } } diff --git a/Assets/Scripts/Input/PlayerController.cs b/Assets/Scripts/Input/PlayerController.cs index d4603e4..c52619c 100644 --- a/Assets/Scripts/Input/PlayerController.cs +++ b/Assets/Scripts/Input/PlayerController.cs @@ -7,15 +7,20 @@ using Random = System.Random; public class PlayerController : MonoBehaviour { public float walkSpeed; + public float gravity; public GameObject model; + public CharacterController cController; private float speedMulitplier; private Vector2 receivedInput; + private Vector3 moveDirection = Vector3.zero; + // Start is called before the first frame update void Start() { speedMulitplier = UnityEngine.Random.Range(0.8f, 1.2f); + cController = GetComponent(); } public void SetMovement(Vector2 input) @@ -28,14 +33,24 @@ public class PlayerController : MonoBehaviour float HorseX, HorseZ; HorseZ = receivedInput.y; HorseX = receivedInput.x; + + if (cController.isGrounded) + { + moveDirection = new Vector3(HorseX, 0, HorseZ); + moveDirection *= walkSpeed * speedMulitplier; + } - float rotateTo = RotateObject(HorseX, HorseZ); + moveDirection.y -= gravity * Time.deltaTime; - HorseZ *= Time.deltaTime * walkSpeed * speedMulitplier; - HorseX *= Time.deltaTime * walkSpeed * speedMulitplier; - + cController.Move(moveDirection * Time.deltaTime); - transform.Translate(HorseX, 0, HorseZ); + + //float rotateTo = RotateObject(HorseX, HorseZ); + //HorseZ *= Time.deltaTime * walkSpeed * speedMulitplier; + //HorseX *= Time.deltaTime * walkSpeed * speedMulitplier; + // + // + //transform.Translate(HorseX, 0, HorseZ); //Vector3 dir = Quaternion.Euler(-90, rotateTo, 0) * Vector3.forward; //model.transform.forward = dir; @@ -78,9 +93,12 @@ public class PlayerController : MonoBehaviour public IEnumerator RandomWait(float wait) { yield return new WaitForSeconds(UnityEngine.Random.Range(0, wait/2)); - - Vector3 rotateDir = new Vector3(90 * Math.Sign(receivedInput.y), 0, -90 * Math.Sign(receivedInput.x)); - model.transform.Rotate(rotateDir, Space.World); + + if (cController.isGrounded) + { + Vector3 rotateDir = new Vector3(90 * Math.Sign(receivedInput.y), 0, -90 * Math.Sign(receivedInput.x)); + model.transform.Rotate(rotateDir, Space.World); + } } // Update is called once per frame diff --git a/Assets/WorldAssets/Models.meta b/Assets/WorldAssets/Models.meta new file mode 100644 index 0000000..fcc3dee --- /dev/null +++ b/Assets/WorldAssets/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c19f0baa368a8624692665b33221020d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WorldAssets/Models/HorseModel.fbx b/Assets/WorldAssets/Models/HorseModel.fbx new file mode 100644 index 0000000..60b749d --- /dev/null +++ b/Assets/WorldAssets/Models/HorseModel.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:712d63ad109ba965eba6194077f2efbe2c816e0bc5357dd522a62ff6b553c59c +size 492149 diff --git a/Assets/WorldAssets/Models/HorseModel.fbx.meta b/Assets/WorldAssets/Models/HorseModel.fbx.meta new file mode 100644 index 0000000..d7197a4 --- /dev/null +++ b/Assets/WorldAssets/Models/HorseModel.fbx.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 707f698da07e87f4ab470faa7ed70d74 +ModelImporter: + serializedVersion: 19300 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 1 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 35 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 0.35 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WorldAssets/Prefabs/Horse.prefab b/Assets/WorldAssets/Prefabs/Horse.prefab index 531d448..fa1b80c 100644 --- a/Assets/WorldAssets/Prefabs/Horse.prefab +++ b/Assets/WorldAssets/Prefabs/Horse.prefab @@ -1,5 +1,36 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &760734042007802935 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8730422608073699851} + m_Layer: 0 + m_Name: Model + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8730422608073699851 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 760734042007802935} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7665367118571749467} + m_Father: {fileID: 7371939184051845512} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &7371939184051845554 GameObject: m_ObjectHideFlags: 0 @@ -29,6 +60,7 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: + - {fileID: 8730422608073699851} - {fileID: 8612686764740273334} m_Father: {fileID: 0} m_RootOrder: 0 @@ -45,8 +77,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8f7fbcfa6410c204e8977bb70e5ff84b, type: 3} m_Name: m_EditorClassIdentifier: - walkSpeed: 2 - model: {fileID: 7954727171190983878} + walkSpeed: 10 + gravity: 35 + model: {fileID: 760734042007802935} + cController: {fileID: 0} --- !u!143 &7371939184051845555 CharacterController: m_ObjectHideFlags: 0 @@ -65,6 +99,81 @@ CharacterController: m_SkinWidth: 0.08 m_MinMoveDistance: 0.001 m_Center: {x: 0, y: 0, z: 0} +--- !u!1001 &3394146243624332097 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8730422608073699851} + m_Modifications: + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalPosition.y + value: -0.249 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -927199367670048503, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + propertyPath: m_Name + value: HorseModel + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 707f698da07e87f4ab470faa7ed70d74, type: 3} +--- !u!4 &7665367118571749467 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: 707f698da07e87f4ab470faa7ed70d74, + type: 3} + m_PrefabInstance: {fileID: 3394146243624332097} + m_PrefabAsset: {fileID: 0} --- !u!1001 &7371939184763441364 PrefabInstance: m_ObjectHideFlags: 0 @@ -77,6 +186,11 @@ PrefabInstance: propertyPath: m_Name value: Cube objectReference: {fileID: 0} + - target: {fileID: 588491153375435794, guid: 4d11c77c6b58b7040a8596bc47f45d97, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 687741958870159176, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} propertyPath: m_LocalPosition.y @@ -120,7 +234,7 @@ PrefabInstance: - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} propertyPath: m_RootOrder - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} @@ -171,12 +285,6 @@ PrefabInstance: - {fileID: -641725564868193174, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} - {fileID: 6187295151528677371, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 4d11c77c6b58b7040a8596bc47f45d97, type: 3} ---- !u!1 &7954727171190983878 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 588491153375435794, guid: 4d11c77c6b58b7040a8596bc47f45d97, - type: 3} - m_PrefabInstance: {fileID: 7371939184763441364} - m_PrefabAsset: {fileID: 0} --- !u!4 &8612686764740273334 stripped Transform: m_CorrespondingSourceObject: {fileID: 1281286576698487906, guid: 4d11c77c6b58b7040a8596bc47f45d97,