using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { [Range(1f, 100f)] [SerializeField] float movementSpeed = 1f; [SerializeField] float rotationSpeed = 1f; [SerializeField] Rigidbody rb; [SerializeField] float jumpForce; // Update is called once per frame void Update() { if (Input.GetKeyDown (KeyCode.LeftShift)) { movementSpeed = 4f; } var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f * rotationSpeed; var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f * movementSpeed; transform.Rotate(0, x, 0); transform.Translate(0, 0, z); if(Input.GetKeyDown(KeyCode.Space)) { rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse); } } }