Иногда мой игрок Unity случайно движется назад. Это случается в большинстве случаев, когда я начинаю подниматься на гору или маленький холм, но затем я перехожу назад (как и ожидалось), но я не могу остановиться, и я увеличиваю карту. Когда я нажимаю, он замедляется и в конечном итоге начинает идти вперед, но со скоростью улитки, и если я отпущу w i Zoom назад. < /P>
using UnityEngine;
public class Movement : MonoBehaviour
{
private Rigidbody rb;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
rb = GetComponent();
}
// Update is called once per frame
public float speed = 10000f;
void Update()
{
float hInput = Input.GetAxis("Horizontal");
float vInput = Input.GetAxis("Vertical");
float jInput = Input.GetAxis("Jump");
Vector3 movement = new Vector3(hInput * speed, jInput * speed, vInput * speed);
rb.MovePosition(rb.position + movement * Time.deltaTime);
float hMouse = Input.GetAxis("Mouse X");
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... -backwards