I keep wondering why the sprite keeps falling whenever I move the car sprite. I already added a collision component for this, and here is what the setting looks like:
Is there anything else that I could do?
CarControl.prototype.update = function (dt) {
if (this.app.keyboard.isPressed(pc.KEY_UP)) {
this.entity.sprite.play("CarMoving");
this.entity.rigidbody.applyForce(0, 20, 0);
}
else if (this.app.keyboard.isPressed(pc.KEY_RIGHT)) {
this.entity.rigidbody.applyForce(20, 0, 0);
}
else if (this.app.keyboard.isPressed(pc.KEY_LEFT)) {
this.entity.rigidbody.applyForce(-20, 0, 0);
}
};