@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.
63 lines (59 loc) • 2.31 kB
JavaScript
import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-CnR665Qq.esm.js';
import { R as RichTypeAny, f as RichTypeVector3 } from './declarationMapper-mPOKbCS_.esm.js';
import { u as RegisterClass } from './index-HyNDfLMI.esm.js';
import './objectModelMapping-OlchA9xj.esm.js';
import './spotLight.pure-C65PiYTZ.esm.js';
/** This file must only contain pure code and pure imports */
/**
* @experimental
* A block that sets the linear velocity of a physics body.
*/
class FlowGraphSetLinearVelocityBlock extends FlowGraphExecutionBlockWithOutSignal {
/**
* Constructs a new FlowGraphSetLinearVelocityBlock.
* @param config - optional configuration for the block
*/
constructor(config) {
super(config);
this.body = this.registerDataInput("body", RichTypeAny);
this.velocity = this.registerDataInput("velocity", 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;
}
physicsBody.setLinearVelocity(this.velocity.getValue(context));
this.out._activateSignal(context);
}
/**
* @returns class name of the block.
*/
getClassName() {
return "FlowGraphSetLinearVelocityBlock" /* FlowGraphBlockNames.PhysicsSetLinearVelocity */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphSetLinearVelocityBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphSetLinearVelocityBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphSetLinearVelocityBlock" /* FlowGraphBlockNames.PhysicsSetLinearVelocity */, FlowGraphSetLinearVelocityBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphSetLinearVelocityBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphSetLinearVelocityBlock();
export { FlowGraphSetLinearVelocityBlock, RegisterFlowGraphSetLinearVelocityBlock };
//# sourceMappingURL=flowGraphSetLinearVelocityBlock-Uo4csTpf.esm.js.map