Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- // dobavete na Game Object nov kompoment RigidBody i sled tova dobavete tozi script, kato go naimenovate Movement
- public class Movement : MonoBehaviour
- {
- // Start is called before the first frame update
- [SerializeField]
- private float speed = 10.0f;
- private Vector3 movement;
- private Rigidbody rb;
- // Start is called before the first frame update
- void Start()
- {
- rb = this.GetComponent<Rigidbody>();
- }
- // Update is called once per frame
- void FixedUpdate()
- {
- //Debug.Log(speed);
- movement = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
- rb.AddForce(movement * speed);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement