|
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class CubeTestController : MonoBehaviour
- {
- [SerializeField]
- private float forwardSpeed = 1;
-
- [SerializeField]
- private float turningSpeed = 90;
-
-
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
- Vector3 _pos = transform.position;
-
- _pos += transform.forward * forwardSpeed * Time.deltaTime;
-
- if (Input.GetKey(KeyCode.A))
- transform.Rotate(new Vector3(0, -turningSpeed * Time.deltaTime, 0));
-
- if (Input.GetKey(KeyCode.D))
- transform.Rotate(new Vector3(0, turningSpeed * Time.deltaTime, 0));
-
- transform.position = _pos;
- }
- }
|