我正在做滚球教程,但我的球没有动。我检查了输入设置。我什至为速度设置了一个值,甚至添加了 Time.deltaTime 但身体没有移动
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}