我希望我的角色能够跳跃,但我不明白为什么他不跳。我的代码使用力和 Rigidbody2D。我是 Unity 的新手,我找不到任何答案。请帮忙?
我的物理代码:
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));
}
}
最佳答案
您已在刚体上检查了“Is Kinematic”,这意味着物理不会影响 。你有理由让它变得运动化吗?
关于javascript - 为什么我的角色不会动?我不明白为什么我的 Rigidbody 2D 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35880843/