UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

66 lines (62 loc) 2.39 kB
import { f as RichTypeVector3, R as RichTypeAny } from './declarationMapper-CqO08-WM.esm.js'; import { F as FlowGraphCachedOperationBlock } from './flowGraphCachedOperationBlock-oE7khWes.esm.js'; import { V as Vector3, u as RegisterClass } from './index-MZPybX0H.esm.js'; import './KHR_interactivity-CEwUaqxQ.esm.js'; import './objectModelMapping-De5EKNEZ.esm.js'; import './spotLight.pure-CRdZC6Ci.esm.js'; /** This file must only contain pure code and pure imports */ /** * @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 */; } } let _Registered = false; /** * Register side effects for flowGraphGetLinearVelocityBlock. * Safe to call multiple times; only the first call has an effect. */ function RegisterFlowGraphGetLinearVelocityBlock() { if (_Registered) { return; } _Registered = true; RegisterClass("FlowGraphGetLinearVelocityBlock" /* FlowGraphBlockNames.PhysicsGetLinearVelocity */, FlowGraphGetLinearVelocityBlock); } /** * Re-exports pure implementation and applies runtime side effects. * Import flowGraphGetLinearVelocityBlock.pure for tree-shakeable, side-effect-free usage. */ RegisterFlowGraphGetLinearVelocityBlock(); export { FlowGraphGetLinearVelocityBlock, RegisterFlowGraphGetLinearVelocityBlock }; //# sourceMappingURL=flowGraphGetLinearVelocityBlock-BEpUJdOc.esm.js.map