我想让我的角色跳跃,但我无法弄清楚为什么他不会。我的代码使用力量和Rigidbody2D。我是Unity的新手,我找不到任何答案。请帮忙?为什么我的角色不会移动?我无法弄清楚为什么我的Rigidbody 2D不起作用
我对物理代码:
var trump;
function Start() {
// Assigns the Rigidbody to a variable
trump = GetComponent(Rigidbody2D);
// Variable Switches:
}
function FixedUpdate() {
if (Input.GetKeyDown(KeyCode.UpArrow)) {
GetComponent.<Rigidbody2D>().AddForce(Vector2(0,20));
}
}
我很乐意帮助,但你必须发布一些代码或更具体。它可能是100件事中的1件。 – Ageonix
我添加了代码。对不起,我不小心通过按回车键进入代码。 – Number1son100
哈哈,我看到你的角色名字是唐纳德特朗普。你在做什么...... – Ageonix