[SOLVED] How to check if an entity is currently moving

Hi @RoaringLegend456! I just learned the way below from @Leonidas. I didn’t test it yet, but you can give it a try.

var velocityOnY = Math.abs(this.entity.rigidbody.linearVelocity.y);
if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
    if (velocityOnY === 0) {
        this.entity.rigidbody.applyImpulse(0,this.jumpforce,0);
    }
}

1 Like