import { b as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-VqtS29i9.esm.js';
import { R as RichTypeAny, k as RichTypeVector3 } from './declarationMapper-CZ6AxirO.esm.js';
import { f as RegisterClass } from './index-Cl9U4nB-.esm.js';
import './objectModelMapping-ghOGfUOh.esm.js';

/**
 * @experimental
 * A block that applies an impulse to a physics body at a given location.
 * Unlike a force (which is applied over time), an impulse is an instantaneous
 * change in momentum.
 */
class FlowGraphApplyImpulseBlock extends FlowGraphExecutionBlockWithOutSignal {
    /**
     * Constructs a new FlowGraphApplyImpulseBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(config);
        this.body = this.registerDataInput("body", RichTypeAny);
        this.impulse = this.registerDataInput("impulse", RichTypeVector3);
        this.location = this.registerDataInput("location", RichTypeVector3);
    }
    /**
     * @internal
     */
    _execute(context, _callingSignal) {
        const physicsBody = this.body.getValue(context);
        if (!physicsBody) {
            this._reportError(context, "No physics body provided");
            this.out._activateSignal(context);
            return;
        }
        const impulseVec = this.impulse.getValue(context);
        const locationVec = this.location.getValue(context);
        physicsBody.applyImpulse(impulseVec, locationVec);
        this.out._activateSignal(context);
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphApplyImpulseBlock" /* FlowGraphBlockNames.PhysicsApplyImpulse */;
    }
}
RegisterClass("FlowGraphApplyImpulseBlock" /* FlowGraphBlockNames.PhysicsApplyImpulse */, FlowGraphApplyImpulseBlock);

export { FlowGraphApplyImpulseBlock };
//# sourceMappingURL=flowGraphApplyImpulseBlock-CzokPfQu.esm.js.map
