Дополнен 8 месяцев назад
вот код
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMuvement : MonoBehaviour
{
public Rigidbody rb;
public float Speed = 50;
public Vector3 newVector3;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
newVector3.z = Input.GetAxis("Vertical");
newVector3.x = Input.GetAxis("Horizontal");
}
void FixedUpdate()
{
rb.MovePosition(rb.position + newVector3 * Speed);
}
}