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.

68 lines (64 loc) 2.54 kB
import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-CEwUaqxQ.esm.js'; import { R as RichTypeAny, f as RichTypeVector3 } from './declarationMapper-CqO08-WM.esm.js'; import { u as RegisterClass } from './index-MZPybX0H.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 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 */; } } let _Registered = false; /** * Register side effects for flowGraphApplyImpulseBlock. * Safe to call multiple times; only the first call has an effect. */ function RegisterFlowGraphApplyImpulseBlock() { if (_Registered) { return; } _Registered = true; RegisterClass("FlowGraphApplyImpulseBlock" /* FlowGraphBlockNames.PhysicsApplyImpulse */, FlowGraphApplyImpulseBlock); } /** * Re-exports pure implementation and applies runtime side effects. * Import flowGraphApplyImpulseBlock.pure for tree-shakeable, side-effect-free usage. */ RegisterFlowGraphApplyImpulseBlock(); export { FlowGraphApplyImpulseBlock, RegisterFlowGraphApplyImpulseBlock }; //# sourceMappingURL=flowGraphApplyImpulseBlock-Du5cYllI.esm.js.map