SHARE
TWEET

Untitled

a guest Jul 16th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top