Advertisement
vitareinforce

camera control

Nov 15th, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Move : MonoBehaviour
  6. {
  7. private float player_move_speed;
  8.  
  9. public GameObject player;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. player.transform.position = new Vector3(-228.3f, 6f, -212.6f);
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update()
  18. {
  19. player_move_speed = 5.0f * Time.deltaTime;
  20.  
  21. float x = Input.GetAxis("Horizontal") * player_move_speed;
  22. float z = Input.GetAxis("Vertical") * player_move_speed;
  23.  
  24. player.transform.Translate(new Vector3(x, 0, z));
  25. }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement