【发布时间】:2016-11-28 01:05:27
【问题描述】:
#pragma strict
private Rigidbody rb;
function Start () {
rb = GetComponent<Rigidbody>();
}
function FixedUpdate () {
var v : float = Input.GetAxis("Vertical");
var h : float = Input.GetAxis("Horizontal");
Vector3 movement = new Vector3 (h, 0.0f, v);
rb.AddForce (movement);
}
我会很感激有一些代码给我看的答案。感谢您抽出宝贵时间回复。
【问题讨论】:
-
那么,错误是什么?
-
Assets/Scripts/PlayerController.js(3,10): BCE0043: Unexpected token: Rigidbody.
-
哦。还有这个 Assets/Scripts/PlayerController.js(13,16): UCE0001: ';'预期的。在末尾插入一个分号。可以清楚的看到v)后面的分号
-
好的。检查我的答案。如果你想在 Unity 中编程,请学习 C#。
标签: javascript unity3d unityscript