如图所示,当人物跳起来时长按方向键,人物会停靠在空中,松开按钮才会掉下来。
是不是我写的代码有问题?

这是我控制人物的代码:
update(dt) {
const v = this.rigidbody.linearVelocity;
if (this.leftLongPress) {
v.x = -200 * 150 * dt;
} else if (this.rightLongPress) {
v.x = 200 * 150 * dt;
} else {
v.x = 0;
}
this.rigidbody.linearVelocity = v;
}
jump() {
const v = this.rigidbody.linearVelocity;
v.y = 800;
this.rigidbody.linearVelocity = v;
}
