Advertisement
Guest User

Movement EksDe

a guest
Nov 13th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class movement : MonoBehaviour
  6. {
  7.  
  8. public float speed;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12.  
  13. }
  14.  
  15. // Update is called once per frame
  16. void Update()
  17. {
  18.  
  19. float horizontal = Input.GetAxisRaw("Horizontal");
  20. float vertical = Input.GetAxisRaw("Vertical");
  21.  
  22. Vector3 direction = new Vector3(horizontal, 0, vertical);
  23. gameObject.transform.Translate(direction.normalized * Time.deltaTime * speed);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement