Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class Ride : MonoBehaviour {
- public float moveSpeed = 15f;
- public float turnSpeed = 0.2f;
- private Rigidbody rb;
- private float moveInput;
- private void Start() {
- rb = GetComponent<Rigidbody>();
- }
- private void Update() { // оновленні екрану
- moveInput = Input.GetAxis("Vertical");
- float turnInput = Input.GetAxis("Horizontal");
- transform.Rotate(0f, turnInput * turnSpeed, 0f);
- }
- private void FixedUpdate() { // сталі проміжки часу (0.02с == 50 фпс)
- rb.AddForce(moveInput * moveSpeed * transform.forward);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement