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

/**
 * @experimental
 * A data block that reads the linear velocity of a physics body.
 */
class FlowGraphGetLinearVelocityBlock extends FlowGraphCachedOperationBlock {
    /**
     * Constructs a new FlowGraphGetLinearVelocityBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(RichTypeVector3, config);
        this.body = this.registerDataInput("body", RichTypeAny);
    }
    /**
     * @internal
     */
    _doOperation(context) {
        const physicsBody = this.body.getValue(context);
        if (!physicsBody) {
            return undefined;
        }
        let result = context._getExecutionVariable(this, "_cachedVelocity", null);
        if (!result) {
            result = new Vector3();
            context._setExecutionVariable(this, "_cachedVelocity", result);
        }
        physicsBody.getLinearVelocityToRef(result);
        return result;
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphGetLinearVelocityBlock" /* FlowGraphBlockNames.PhysicsGetLinearVelocity */;
    }
}
RegisterClass("FlowGraphGetLinearVelocityBlock" /* FlowGraphBlockNames.PhysicsGetLinearVelocity */, FlowGraphGetLinearVelocityBlock);

export { FlowGraphGetLinearVelocityBlock };
//# sourceMappingURL=flowGraphGetLinearVelocityBlock-LSyWBmUS.esm.js.map
