SHOW:
|
|
- or go back to the newest paste.
1 | import UnityEngine | |
2 | ||
3 | class MovementScript (MonoBehaviour): | |
4 | - | public float moveSpeed = 50 |
4 | + | public float moveSpeed = 50; |
5 | ||
6 | def FixedUpdate() { | |
7 | MaybeMove(); | |
8 | } | |
9 | ||
10 | def MaybeMove(){ | |
11 | Vector3 moveDir = (Input.GetAxisRaw("Horizontal") * Vector3.right) + (Input.GetAxisRaw("Vertical") * Vector3.forward); | |
12 | - | moveDir = (Input.GetAxisRaw("Horizontal") * Vector3.right) + (Input.GetAxisRaw("Vertical") * Vector3.forward); |
12 | + | transform.Translate(moveDir.normalized * realSpeed * Time.deltaTime); |
13 | - | transform.Translate(moveDir.normalized * realSpeed * Time.deltaTime); |
13 | + |