UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

42 lines 1.62 kB
import { RichTypeAny, RichTypeVector3 } from "../../../flowGraphRichTypes.js"; import { RegisterClass } from "../../../../Misc/typeStore.js"; import { FlowGraphCachedOperationBlock } from "../flowGraphCachedOperationBlock.js"; import { Vector3 } from "../../../../Maths/math.vector.js"; /** * @experimental * A data block that reads the angular velocity of a physics body. */ export class FlowGraphGetAngularVelocityBlock extends FlowGraphCachedOperationBlock { /** * Constructs a new FlowGraphGetAngularVelocityBlock. * @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.getAngularVelocityToRef(result); return result; } /** * @returns class name of the block. */ getClassName() { return "FlowGraphGetAngularVelocityBlock" /* FlowGraphBlockNames.PhysicsGetAngularVelocity */; } } RegisterClass("FlowGraphGetAngularVelocityBlock" /* FlowGraphBlockNames.PhysicsGetAngularVelocity */, FlowGraphGetAngularVelocityBlock); //# sourceMappingURL=flowGraphGetAngularVelocityBlock.js.map