Unity 5 Ball不会移动没有错误

时间:2016-07-13 20:48:30

标签: c# unity3d

我有一个简单的默认统一3d球体它使用刚体组件附加到它上面当我使用箭头键(在输入中设置)时它意味着移动但它什么都不做没有控制台错误这里没有什么是我的剧本

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {
    private Rigidbody PhysicsRB;
public float speed;

void Start ()
{
    speed = 5;
    PhysicsRB = GetComponent<Rigidbody>();
}

void Fixedupdate () {
    float MoveH = Input.GetAxis ("Horizontal");
    float MoveV = Input.GetAxis ("Vertical");

    Vector3 movement = new Vector3 (MoveH, 0.0f, MoveV);

    PhysicsRB.AddForce (movement * speed);

}       
}

1 个答案:

答案 0 :(得分:3)

将“Fixedupdate”更改为“FixedUpdate”。还要确保文件名与类名相同。在您的示例中,您的脚本应该被称为PlayerController.cs。