Untitled
unknown
plain_text
a month ago
583 B
7
Indexable
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { [SerializeField] private Rigidbody rbody; [SerializeField] private float speed = 5; private Vector3 input; void Update(){ GatherInput(); } void FixedUpdate() { Move(); } void GatherInput() { input = new Vector3(Input.GetAxisRaw("Horizontal"),0, Input.GetAxisRaw("Vertical")); } void Move() { rbody.MovePosition(transform.position + input * speed * Time.fixedDeltaTime); } }
Editor is loading...
Leave a Comment