isKinematic im Script geändert um das springen zu verbessern. Weiß aber noch nicht ob das die beste Lösung ist
This commit is contained in:
parent
aedc9d659e
commit
d91ab65c06
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user