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

/**
 * @experimental
 * A data block that reads the mass properties of a physics body.
 * Outputs the mass, center of mass (local space), and principal inertia.
 */
class FlowGraphGetPhysicsMassPropertiesBlock extends FlowGraphBlock {
    /**
     * Constructs a new FlowGraphGetPhysicsMassPropertiesBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(config);
        this.body = this.registerDataInput("body", RichTypeAny);
        this.mass = this.registerDataOutput("mass", RichTypeNumber);
        this.centerOfMass = this.registerDataOutput("centerOfMass", RichTypeVector3);
        this.inertia = this.registerDataOutput("inertia", RichTypeVector3);
    }
    /**
     * @internal
     */
    _updateOutputs(context) {
        const physicsBody = this.body.getValue(context);
        if (!physicsBody) {
            return;
        }
        const props = physicsBody.getMassProperties();
        if (props.mass !== undefined) {
            this.mass.setValue(props.mass, context);
        }
        if (props.centerOfMass) {
            this.centerOfMass.setValue(props.centerOfMass, context);
        }
        if (props.inertia) {
            this.inertia.setValue(props.inertia, context);
        }
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphGetPhysicsMassPropertiesBlock" /* FlowGraphBlockNames.PhysicsGetMassProperties */;
    }
}
RegisterClass("FlowGraphGetPhysicsMassPropertiesBlock" /* FlowGraphBlockNames.PhysicsGetMassProperties */, FlowGraphGetPhysicsMassPropertiesBlock);

export { FlowGraphGetPhysicsMassPropertiesBlock };
//# sourceMappingURL=flowGraphGetPhysicsMassPropertiesBlock-C247I4oa.esm.js.map
