Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PlayerMoveByTransform : MonoBehaviour{
- public float speed = 3f;
- void FixedUpdate(){
- Vector3 xzmove = (transform.forward * Input.GetAxis("Vertical") * speed ) + (transform.right * Input.GetAxis("Horizontal") * speed );
- gameObject.transform.position += new Vector3( xzmove.x ,0, xzmove.z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement