PlayerController laufen funktioniert jetzt
This commit is contained in:
@@ -19,19 +19,23 @@ public class PlayerController : MonoBehaviour
|
|||||||
position = Vector3.zero;
|
position = Vector3.zero;
|
||||||
if (Input.GetKey(KeyCode.W))
|
if (Input.GetKey(KeyCode.W))
|
||||||
{
|
{
|
||||||
position += Vector3.forward;
|
position += Vector3.forward * speed;
|
||||||
}
|
}
|
||||||
if (Input.GetKey(KeyCode.A))
|
if (Input.GetKey(KeyCode.A))
|
||||||
{
|
{
|
||||||
position += Vector3.left;
|
position += Vector3.left * speed;
|
||||||
}
|
}
|
||||||
if (Input.GetKey(KeyCode.S))
|
if (Input.GetKey(KeyCode.S))
|
||||||
{
|
{
|
||||||
position += Vector3.back;
|
position += Vector3.back * speed;
|
||||||
}
|
}
|
||||||
if (Input.GetKey(KeyCode.D))
|
if (Input.GetKey(KeyCode.D))
|
||||||
{
|
{
|
||||||
position += Vector3.right;
|
position += Vector3.right * speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
rb.linearVelocity = position.normalized * speed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user