From d91ab65c063dc1de94dcc98314e46ed0854f7946 Mon Sep 17 00:00:00 2001 From: Jan Breitkreuz Date: Wed, 19 Jun 2024 12:55:59 +0200 Subject: [PATCH] =?UTF-8?q?isKinematic=20im=20Script=20ge=C3=A4ndert=20um?= =?UTF-8?q?=20das=20springen=20zu=20verbessern.=20Wei=C3=9F=20aber=20noch?= =?UTF-8?q?=20nicht=20ob=20das=20die=20beste=20L=C3=B6sung=20ist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/ScriptsJan/PlayerScripts/PlayerMoveScript.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plunderblock/Assets/Scripts/ScriptsJan/PlayerScripts/PlayerMoveScript.cs b/Plunderblock/Assets/Scripts/ScriptsJan/PlayerScripts/PlayerMoveScript.cs index 9d8e417..3e4fadb 100644 --- a/Plunderblock/Assets/Scripts/ScriptsJan/PlayerScripts/PlayerMoveScript.cs +++ b/Plunderblock/Assets/Scripts/ScriptsJan/PlayerScripts/PlayerMoveScript.cs @@ -39,10 +39,10 @@ public class PlayerMoveScript : MonoBehaviour // Update is called once per frame void Update() { + jump(); move(); look(); lockCursor(); - jump(); } @@ -65,11 +65,12 @@ public class PlayerMoveScript : MonoBehaviour public void jump() { - if(Input.GetKeyDown(KeyCode.Space)) + if(Input.GetKey(KeyCode.Space)) { if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.down), checkForJump)) { - rb.velocity = new Vector3(rb.velocity.x, 0, rb.velocity.z); + rb.isKinematic = true; + rb.isKinematic = false; rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse); } }