@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.64 kB
JavaScript
import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-CEwUaqxQ.esm.js';
import { R as RichTypeAny, d as RichTypeNumber } 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 sets the motion type of a physics body.
*
* The motion type input is a number corresponding to the PhysicsMotionType enum:
* - 0 = STATIC (not moving, not affected by forces)
* - 1 = ANIMATED (not affected by other bodies, but pushes them)
* - 2 = DYNAMIC (fully simulated, affected by forces and collisions)
*/
class FlowGraphSetPhysicsMotionTypeBlock extends FlowGraphExecutionBlockWithOutSignal {
/**
* Constructs a new FlowGraphSetPhysicsMotionTypeBlock.
* @param config - optional configuration for the block
*/
constructor(config) {
super(config);
this.body = this.registerDataInput("body", RichTypeAny);
this.motionType = this.registerDataInput("motionType", RichTypeNumber, 2 /* PhysicsMotionType.DYNAMIC */);
}
/**
* @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.setMotionType(this.motionType.getValue(context));
this.out._activateSignal(context);
}
/**
* @returns class name of the block.
*/
getClassName() {
return "FlowGraphSetPhysicsMotionTypeBlock" /* FlowGraphBlockNames.PhysicsSetMotionType */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphSetPhysicsMotionTypeBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphSetPhysicsMotionTypeBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphSetPhysicsMotionTypeBlock" /* FlowGraphBlockNames.PhysicsSetMotionType */, FlowGraphSetPhysicsMotionTypeBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphSetPhysicsMotionTypeBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphSetPhysicsMotionTypeBlock();
export { FlowGraphSetPhysicsMotionTypeBlock, RegisterFlowGraphSetPhysicsMotionTypeBlock };
//# sourceMappingURL=flowGraphSetPhysicsMotionTypeBlock-KT8QAq9g.esm.js.map