Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlayerMoveByTransform : MonoBehaviour{
  6.  
  7. public float speed = 3f;
  8.  
  9. void FixedUpdate(){
  10. Vector3 xzmove = (transform.forward * Input.GetAxis("Vertical") * speed ) + (transform.right * Input.GetAxis("Horizontal") * speed );
  11. gameObject.transform.position += new Vector3( xzmove.x ,0, xzmove.z);
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement