diff --git a/Assets/Scenes/TestScene.unity b/Assets/Scenes/TestScene.unity index 8566c70..d64e980 100644 --- a/Assets/Scenes/TestScene.unity +++ b/Assets/Scenes/TestScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -352,9 +352,9 @@ MonoBehaviour: walkSpeed: 6 moveSmoothTime: 0.05 gravity: -13 - jumpHeight: 2.5 + jumpHeight: 2 groundCheck: {fileID: 1473696487} - groundDistance: 1 + groundDistance: 0.2 groundMask: serializedVersion: 2 m_Bits: 64 @@ -373,7 +373,7 @@ CharacterController: m_Height: 2 m_Radius: 0.5 m_SlopeLimit: 45 - m_StepOffset: 0.3 + m_StepOffset: 0.05 m_SkinWidth: 0.08 m_MinMoveDistance: 0.001 m_Center: {x: 0, y: 1, z: 0} @@ -743,11 +743,11 @@ RectTransform: m_Father: {fileID: 145653193} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 230.1, y: 265.52} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -14, y: -25} m_SizeDelta: {x: 560.5, y: 50} - m_Pivot: {x: 0.5, y: 0.5} + m_Pivot: {x: 1, y: 1} --- !u!114 &857589338 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1151,11 +1151,11 @@ RectTransform: m_Father: {fileID: 145653193} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 230.1, y: 299.26} - m_SizeDelta: {x: 560.5, y: 17.47} - m_Pivot: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -14, y: 0.000030517578} + m_SizeDelta: {x: 560.5, y: 17.470001} + m_Pivot: {x: 1, y: 1} --- !u!114 &1960893055 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1265,8 +1265,8 @@ GameObject: - component: {fileID: 2119583732} - component: {fileID: 2119583731} - component: {fileID: 2119583730} - m_Layer: 0 - m_Name: s + m_Layer: 6 + m_Name: TestUnityCube m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Scripts/DebugCanvas.cs b/Assets/Scripts/DebugCanvas.cs index 00a5b6f..8d625a0 100644 --- a/Assets/Scripts/DebugCanvas.cs +++ b/Assets/Scripts/DebugCanvas.cs @@ -7,9 +7,15 @@ public class DebugCanvas : MonoBehaviour { public TextMeshProUGUI DebugTextGrounded; public GameObject Player; + public TextMeshProUGUI fpsText; + public float deltaTime; private void Update() { DebugTextGrounded.text = "isGrounded: " + Player.GetComponent().isGrounded.ToString(); + + deltaTime += (Time.deltaTime - deltaTime) * 0.1f; + float fps = 1.0f / deltaTime; + fpsText.text = Mathf.Ceil(fps).ToString() + "FPS"; } } diff --git a/Assets/Scripts/Player/PlayerController.cs b/Assets/Scripts/Player/PlayerController.cs index 398439d..b4720ab 100644 --- a/Assets/Scripts/Player/PlayerController.cs +++ b/Assets/Scripts/Player/PlayerController.cs @@ -72,6 +72,10 @@ public class PlayerController : MonoBehaviour } private void UpdateMovement() { + //Grounded + velocityY += gravity * Time.deltaTime; + if (isGrounded && velocityY < 0) + velocityY = 0.0f; //Jump if (Input.GetButtonDown("Jump") && isGrounded) @@ -80,14 +84,6 @@ public class PlayerController : MonoBehaviour velocityY += Mathf.Sqrt(jumpHeight * -2f * gravity); } - //Grounded - - if (isGrounded) - velocityY = 0.0f; - - velocityY += gravity * Time.deltaTime; - - Vector2 targetDir = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); //Get Inputs targetDir.Normalize(); //Damit schräg laufen nicht schneller ist diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index b543455..7ee2faf 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -8,6 +8,9 @@ EditorUserSettings: RecentlyUsedScenePath-0: value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d flags: 0 + RecentlyUsedScenePath-1: + value: 22424703114646680e0b0227036c6b1505032b292926237e38271427fb + flags: 0 vcSharedLogLevel: value: 0d5e400f0650 flags: 0