1 |
- {"ast":null,"code":"import { PhysicsPrestepType } from \"./IPhysicsEnginePlugin.js\";\nimport { Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector.js\";\n/**\n * PhysicsBody is useful for creating a physics body that can be used in a physics engine. It allows\n * the user to set the mass and velocity of the body, which can then be used to calculate the\n * motion of the body in the physics engine.\n */\nexport class PhysicsBody {\n /**\n * Disable pre-step that consists in updating Physics Body from Transform Node Translation/Orientation.\n * True by default for maximum performance.\n */\n get disablePreStep() {\n return this._prestepType == PhysicsPrestepType.DISABLED;\n }\n set disablePreStep(value) {\n this._prestepType = value ? PhysicsPrestepType.DISABLED : PhysicsPrestepType.TELEPORT;\n }\n /**\n * Constructs a new physics body for the given node.\n * @param transformNode - The Transform Node to construct the physics body for. For better performance, it is advised that this node does not have a parent.\n * @param motionType - The motion type of the physics body. The options are:\n * - PhysicsMotionType.STATIC - Static bodies are not moving and unaffected by forces or collisions. They are good for level boundaries or terrain.\n * - PhysicsMotionType.DYNAMIC - Dynamic bodies are fully simulated. They can move and collide with other objects.\n * - PhysicsMotionType.ANIMATED - They behave like dynamic bodies, but they won't be affected by other bodies, but still push other bodies out of the way.\n * @param startsAsleep - Whether the physics body should start in a sleeping state (not a guarantee). Defaults to false.\n * @param scene - The scene containing the physics engine.\n *\n * This code is useful for creating a physics body for a given Transform Node in a scene.\n * It checks the version of the physics engine and the physics plugin, and initializes the body accordingly.\n * It also sets the node's rotation quaternion if it is not already set. Finally, it adds the body to the physics engine.\n */\n constructor(transformNode, motionType, startsAsleep, scene) {\n /**\n * V2 Physics plugin private data for single Transform\n */\n this._pluginData = undefined;\n /**\n * V2 Physics plugin private data for instances\n */\n this._pluginDataInstances = [];\n /**\n * If the collision callback is enabled\n */\n this._collisionCBEnabled = false;\n /**\n * If the collision ended callback is enabled\n */\n this._collisionEndedCBEnabled = false;\n /**\n * Disable sync from physics to transformNode. This value is set to true at body creation or at motionType setting when the body is not dynamic.\n */\n this.disableSync = false;\n this._isDisposed = false;\n this._shape = null;\n this._prestepType = PhysicsPrestepType.DISABLED;\n if (!scene) {\n return;\n }\n const physicsEngine = scene.getPhysicsEngine();\n if (!physicsEngine) {\n throw new Error(\"No Physics Engine available.\");\n }\n this._physicsEngine = physicsEngine;\n if (physicsEngine.getPluginVersion() != 2) {\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\n }\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\n if (!physicsPlugin) {\n throw new Error(\"No Physics Plugin available.\");\n }\n this._physicsPlugin = physicsPlugin;\n if (!transformNode.rotationQuaternion) {\n transformNode.rotationQuaternion = Quaternion.FromEulerAngles(transformNode.rotation.x, transformNode.rotation.y, transformNode.rotation.z);\n }\n this.startAsleep = startsAsleep;\n this._motionType = motionType;\n // only dynamic and animated body needs sync from physics to transformNode\n this.disableSync = motionType == 0 /* PhysicsMotionType.STATIC */;\n // instances?\n const m = transformNode;\n if (m.hasThinInstances) {\n this._physicsPlugin.initBodyInstances(this, motionType, m);\n } else {\n // single instance\n if (transformNode.parent) {\n // Force computation of world matrix so that the parent transforms are correctly reflected in absolutePosition/absoluteRotationQuaternion.\n transformNode.computeWorldMatrix(true);\n }\n this._physicsPlugin.initBody(this, motionType, transformNode.absolutePosition, transformNode.absoluteRotationQuaternion);\n }\n this.transformNode = transformNode;\n transformNode.physicsBody = this;\n physicsEngine.addBody(this);\n this._nodeDisposeObserver = transformNode.onDisposeObservable.add(() => {\n this.dispose();\n });\n }\n /**\n * Returns the string \"PhysicsBody\".\n * @returns \"PhysicsBody\"\n */\n getClassName() {\n return \"PhysicsBody\";\n }\n /**\n * Clone the PhysicsBody to a new body and assign it to the transformNode parameter\n * @param transformNode transformNode that will be used for the cloned PhysicsBody\n * @returns the newly cloned PhysicsBody\n */\n clone(transformNode) {\n const clonedBody = new PhysicsBody(transformNode, this.getMotionType(), this.startAsleep, this.transformNode.getScene());\n clonedBody.shape = this.shape;\n clonedBody.setMassProperties(this.getMassProperties());\n clonedBody.setLinearDamping(this.getLinearDamping());\n clonedBody.setAngularDamping(this.getAngularDamping());\n return clonedBody;\n }\n /**\n * If a physics body is connected to an instanced node, update the number physic instances to match the number of node instances.\n */\n updateBodyInstances() {\n const m = this.transformNode;\n if (m.hasThinInstances) {\n this._physicsPlugin.updateBodyInstances(this, m);\n }\n }\n /**\n * This returns the number of internal instances of the physics body\n */\n get numInstances() {\n return this._pluginDataInstances.length;\n }\n /**\n * Get the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\n */\n get motionType() {\n return this._motionType;\n }\n /**\n * Sets the shape of the physics body.\n * @param shape - The shape of the physics body.\n *\n * This method is useful for setting the shape of the physics body, which is necessary for the physics engine to accurately simulate the body's behavior.\n * The shape is used to calculate the body's mass, inertia, and other properties.\n */\n set shape(shape) {\n this._shape = shape;\n if (shape) {\n this._physicsPlugin.setShape(this, shape);\n }\n }\n /**\n * Retrieves the physics shape associated with this object.\n *\n * @returns The physics shape associated with this object, or `undefined` if no\n * shape is associated.\n *\n * This method is useful for retrieving the physics shape associated with this object,\n * which can be used to apply physical forces to the object or to detect collisions.\n */\n get shape() {\n return this._shape;\n }\n /**\n * Returns the bounding box of the physics body.\n * @returns The bounding box of the physics body.\n */\n getBoundingBox() {\n return this._physicsPlugin.getBodyBoundingBox(this);\n }\n /**\n * Sets the event mask for the physics engine.\n *\n * @param eventMask - A bitmask that determines which events will be sent to the physics engine.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the event mask for.\n *\n * This method is useful for setting the event mask for the physics engine, which determines which events\n * will be sent to the physics engine. This allows the user to control which events the physics engine will respond to.\n */\n setEventMask(eventMask, instanceIndex) {\n this._physicsPlugin.setEventMask(this, eventMask, instanceIndex);\n }\n /**\n * Gets the event mask of the physics engine.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the event mask for.\n * @returns The event mask of the physics engine.\n *\n * This method is useful for getting the event mask of the physics engine,\n * which is used to determine which events the engine will respond to.\n * This is important for ensuring that the engine is responding to the correct events and not\n * wasting resources on unnecessary events.\n */\n getEventMask(instanceIndex) {\n return this._physicsPlugin.getEventMask(this, instanceIndex);\n }\n /**\n * Sets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\n * @param motionType - The motion type to set.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the motion type for.\n */\n setMotionType(motionType, instanceIndex) {\n this.disableSync = motionType == 0 /* PhysicsMotionType.STATIC */;\n this._physicsPlugin.setMotionType(this, motionType, instanceIndex);\n }\n /**\n * Gets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the motion type for.\n * @returns The motion type of the physics body.\n */\n getMotionType(instanceIndex) {\n return this._physicsPlugin.getMotionType(this, instanceIndex);\n }\n /**\n * Set the prestep type of the body\n * @param prestepType prestep type provided by PhysicsPrestepType\n */\n setPrestepType(prestepType) {\n this._prestepType = prestepType;\n }\n /**\n * Get the current prestep type of the body\n * @returns the type of prestep associated with the body and its instance index\n */\n getPrestepType() {\n return this._prestepType;\n }\n /**\n * Computes the mass properties of the physics object, based on the set of physics shapes this body uses.\n * This method is useful for computing the initial mass properties of a physics object, such as its mass,\n * inertia, and center of mass; these values are important for accurately simulating the physics of the\n * object in the physics engine, and computing values based on the shape will provide you with reasonable\n * initial values, which you can then customize.\n * @param instanceIndex - The index of the instance to compute the mass properties for.\n * @returns The mass properties of the object.\n */\n computeMassProperties(instanceIndex) {\n return this._physicsPlugin.computeMassProperties(this, instanceIndex);\n }\n /**\n * Sets the mass properties of the physics object.\n *\n * @param massProps - The mass properties to set.\n * @param instanceIndex - The index of the instance to set the mass properties for. If not defined, the mass properties will be set for all instances.\n *\n * This method is useful for setting the mass properties of a physics object, such as its mass,\n * inertia, and center of mass. This is important for accurately simulating the physics of the object in the physics engine.\n */\n setMassProperties(massProps, instanceIndex) {\n this._physicsPlugin.setMassProperties(this, massProps, instanceIndex);\n }\n /**\n * Retrieves the mass properties of the object.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the mass properties for.\n * @returns The mass properties of the object.\n *\n * This method is useful for physics simulations, as it allows the user to\n * retrieve the mass properties of the object, such as its mass, center of mass,\n * and moment of inertia. This information is necessary for accurate physics\n * simulations.\n */\n getMassProperties(instanceIndex) {\n return this._physicsPlugin.getMassProperties(this, instanceIndex);\n }\n /**\n * Sets the linear damping of the physics body.\n *\n * @param damping - The linear damping value.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear damping for.\n *\n * This method is useful for controlling the linear damping of the physics body,\n * which is the rate at which the body's velocity decreases over time. This is useful for simulating\n * the effects of air resistance or other forms of friction.\n */\n setLinearDamping(damping, instanceIndex) {\n this._physicsPlugin.setLinearDamping(this, damping, instanceIndex);\n }\n /**\n * Gets the linear damping of the physics body.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear damping for.\n * @returns The linear damping of the physics body.\n *\n * This method is useful for retrieving the linear damping of the physics body, which is the amount of\n * resistance the body has to linear motion. This is useful for simulating realistic physics behavior\n * in a game.\n */\n getLinearDamping(instanceIndex) {\n return this._physicsPlugin.getLinearDamping(this, instanceIndex);\n }\n /**\n * Sets the angular damping of the physics body.\n * @param damping The angular damping of the body.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular damping for.\n *\n * This method is useful for controlling the angular velocity of a physics body.\n * By setting the damping, the body's angular velocity will be reduced over time, simulating the effect of friction.\n * This can be used to create realistic physical behavior in a physics engine.\n */\n setAngularDamping(damping, instanceIndex) {\n this._physicsPlugin.setAngularDamping(this, damping, instanceIndex);\n }\n /**\n * Gets the angular damping of the physics body.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular damping for.\n *\n * @returns The angular damping of the physics body.\n *\n * This method is useful for getting the angular damping of the physics body,\n * which is the rate of reduction of the angular velocity over time.\n * This is important for simulating realistic physics behavior in a game.\n */\n getAngularDamping(instanceIndex) {\n return this._physicsPlugin.getAngularDamping(this, instanceIndex);\n }\n /**\n * Sets the linear velocity of the physics object.\n * @param linVel - The linear velocity to set.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear velocity for.\n *\n * This method is useful for setting the linear velocity of a physics object,\n * which is necessary for simulating realistic physics in a game engine.\n * By setting the linear velocity, the physics object will move in the direction and speed specified by the vector.\n * This allows for realistic physics simulations, such as simulating the motion of a ball rolling down a hill.\n */\n setLinearVelocity(linVel, instanceIndex) {\n this._physicsPlugin.setLinearVelocity(this, linVel, instanceIndex);\n }\n /**\n * Gets the linear velocity of the physics body and stores it in the given vector3.\n * @param linVel - The vector3 to store the linear velocity in.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\n *\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\n */\n getLinearVelocityToRef(linVel, instanceIndex) {\n this._physicsPlugin.getLinearVelocityToRef(this, linVel, instanceIndex);\n }\n /**\n * Gets the linear velocity of the physics body as a new vector3.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\n * @returns The linear velocity of the physics body.\n *\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\n */\n getLinearVelocity(instanceIndex) {\n const ref = new Vector3();\n this.getLinearVelocityToRef(ref, instanceIndex);\n return ref;\n }\n /**\n * Sets the angular velocity of the physics object.\n * @param angVel - The angular velocity to set.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular velocity for.\n *\n * This method is useful for setting the angular velocity of a physics object, which is necessary for\n * simulating realistic physics behavior. The angular velocity is used to determine the rate of rotation of the object,\n * which is important for simulating realistic motion.\n */\n setAngularVelocity(angVel, instanceIndex) {\n this._physicsPlugin.setAngularVelocity(this, angVel, instanceIndex);\n }\n /**\n * Gets the angular velocity of the physics body and stores it in the given vector3.\n * @param angVel - The vector3 to store the angular velocity in.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\n *\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\n * rotational speed. This information can be used to create realistic physics simulations.\n */\n getAngularVelocityToRef(angVel, instanceIndex) {\n this._physicsPlugin.getAngularVelocityToRef(this, angVel, instanceIndex);\n }\n /**\n * Gets the angular velocity of the physics body as a new vector3.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\n * @returns The angular velocity of the physics body.\n *\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\n * rotational speed. This information can be used to create realistic physics simulations.\n */\n getAngularVelocity(instanceIndex) {\n const ref = new Vector3();\n this.getAngularVelocityToRef(ref, instanceIndex);\n return ref;\n }\n /**\n * Applies an impulse to the physics object.\n *\n * @param impulse The impulse vector.\n * @param location The location of the impulse.\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\n *\n * This method is useful for applying an impulse to a physics object, which can be used to simulate physical forces such as gravity,\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\n */\n applyImpulse(impulse, location, instanceIndex) {\n this._physicsPlugin.applyImpulse(this, impulse, location, instanceIndex);\n }\n /**\n * Add torque to a physics body\n * @param angularImpulse The angular impulse vector.\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\n */\n applyAngularImpulse(angularImpulse, instanceIndex) {\n this._physicsPlugin.applyAngularImpulse(this, angularImpulse, instanceIndex);\n }\n /**\n * Applies a force to the physics object.\n *\n * @param force The force vector.\n * @param location The location of the force.\n * @param instanceIndex For a instanced body, the instance to where the force should be applied. If not specified, the force is applied to all instances.\n *\n * This method is useful for applying a force to a physics object, which can be used to simulate physical forces such as gravity,\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\n */\n applyForce(force, location, instanceIndex) {\n this._physicsPlugin.applyForce(this, force, location, instanceIndex);\n }\n /**\n * Retrieves the geometry of the body from the physics plugin.\n *\n * @returns The geometry of the body.\n *\n * This method is useful for retrieving the geometry of the body from the physics plugin, which can be used for various physics calculations.\n */\n getGeometry() {\n return this._physicsPlugin.getBodyGeometry(this);\n }\n /**\n * Returns an observable that will be notified for when a collision starts or continues for this PhysicsBody\n * @returns Observable\n */\n getCollisionObservable() {\n return this._physicsPlugin.getCollisionObservable(this);\n }\n /**\n * Returns an observable that will be notified when the body has finished colliding with another body\n * @returns\n */\n getCollisionEndedObservable() {\n return this._physicsPlugin.getCollisionEndedObservable(this);\n }\n /**\n * Enable or disable collision callback for this PhysicsBody.\n * @param enabled true if PhysicsBody's collision will rise a collision event and notifies the observable\n */\n setCollisionCallbackEnabled(enabled) {\n this._collisionCBEnabled = enabled;\n this._physicsPlugin.setCollisionCallbackEnabled(this, enabled);\n }\n /**\n * Enable or disable collision ended callback for this PhysicsBody.\n * @param enabled true if PhysicsBody's collision ended will rise a collision event and notifies the observable\n */\n setCollisionEndedCallbackEnabled(enabled) {\n this._collisionEndedCBEnabled = enabled;\n this._physicsPlugin.setCollisionEndedCallbackEnabled(this, enabled);\n }\n /**\n * Get the center of the object in world space.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\n * @returns geometric center of the associated mesh\n */\n getObjectCenterWorld(instanceIndex) {\n const ref = new Vector3();\n return this.getObjectCenterWorldToRef(ref, instanceIndex);\n }\n /**\n * Get the center of the object in world space.\n * @param ref - The vector3 to store the result in.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\n * @returns geometric center of the associated mesh\n */\n getObjectCenterWorldToRef(ref, instanceIndex) {\n var _this$_pluginDataInst;\n if (((_this$_pluginDataInst = this._pluginDataInstances) === null || _this$_pluginDataInst === void 0 ? void 0 : _this$_pluginDataInst.length) > 0) {\n const index = instanceIndex || 0;\n const matrixData = this.transformNode._thinInstanceDataStorage.matrixData;\n if (matrixData) {\n ref.set(matrixData[index * 16 + 12], matrixData[index * 16 + 13], matrixData[index * 16 + 14]);\n }\n } else {\n ref.copyFrom(this.transformNode.position);\n }\n return ref;\n }\n /**\n * Adds a constraint to the physics engine.\n *\n * @param childBody - The body to which the constraint will be applied.\n * @param constraint - The constraint to be applied.\n * @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\n * @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\n *\n */\n addConstraint(childBody, constraint, instanceIndex, childInstanceIndex) {\n this._physicsPlugin.addConstraint(this, childBody, constraint, instanceIndex, childInstanceIndex);\n }\n /**\n * Sync with a bone\n * @param bone The bone that the impostor will be synced to.\n * @param boneMesh The mesh that the bone is influencing.\n * @param jointPivot The pivot of the joint / bone in local space.\n * @param distToJoint Optional distance from the impostor to the joint.\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\n * @param boneAxis Optional vector3 axis the bone is aligned with\n */\n syncWithBone(bone, boneMesh, jointPivot, distToJoint, adjustRotation, boneAxis) {\n const mesh = this.transformNode;\n if (mesh.rotationQuaternion) {\n if (adjustRotation) {\n const tempQuat = TmpVectors.Quaternion[0];\n bone.getRotationQuaternionToRef(1 /* Space.WORLD */, boneMesh, tempQuat);\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\n } else {\n bone.getRotationQuaternionToRef(1 /* Space.WORLD */, boneMesh, mesh.rotationQuaternion);\n }\n }\n const pos = TmpVectors.Vector3[0];\n const boneDir = TmpVectors.Vector3[1];\n if (!boneAxis) {\n boneAxis = TmpVectors.Vector3[2];\n boneAxis.x = 0;\n boneAxis.y = 1;\n boneAxis.z = 0;\n }\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\n bone.getAbsolutePositionToRef(boneMesh, pos);\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\n distToJoint = jointPivot.length();\n }\n if (distToJoint !== undefined && distToJoint !== null) {\n pos.x += boneDir.x * distToJoint;\n pos.y += boneDir.y * distToJoint;\n pos.z += boneDir.z * distToJoint;\n }\n mesh.setAbsolutePosition(pos);\n }\n /**\n * Executes a callback on the body or all of the instances of a body\n * @param callback the callback to execute\n */\n iterateOverAllInstances(callback) {\n var _this$_pluginDataInst2;\n if (((_this$_pluginDataInst2 = this._pluginDataInstances) === null || _this$_pluginDataInst2 === void 0 ? void 0 : _this$_pluginDataInst2.length) > 0) {\n for (let i = 0; i < this._pluginDataInstances.length; i++) {\n callback(this, i);\n }\n } else {\n callback(this, undefined);\n }\n }\n /**\n * Sets the gravity factor of the physics body\n * @param factor the gravity factor to set\n * @param instanceIndex the instance of the body to set, if undefined all instances will be set\n */\n setGravityFactor(factor, instanceIndex) {\n this._physicsPlugin.setGravityFactor(this, factor, instanceIndex);\n }\n /**\n * Gets the gravity factor of the physics body\n * @param instanceIndex the instance of the body to get, if undefined the value of first instance will be returned\n * @returns the gravity factor\n */\n getGravityFactor(instanceIndex) {\n return this._physicsPlugin.getGravityFactor(this, instanceIndex);\n }\n /**\n * Set the target transformation (position and rotation) of the body, such that the body will set its velocity to reach that target\n * @param position The target position\n * @param rotation The target rotation\n * @param instanceIndex The index of the instance in an instanced body\n */\n setTargetTransform(position, rotation, instanceIndex) {\n this._physicsPlugin.setTargetTransform(this, position, rotation, instanceIndex);\n }\n /**\n * Returns if the body has been disposed.\n * @returns true if disposed, false otherwise.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Disposes the body from the physics engine.\n *\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n // Disable collisions CB so it doesn't fire when the body is disposed\n if (this._collisionCBEnabled) {\n this.setCollisionCallbackEnabled(false);\n }\n if (this._collisionEndedCBEnabled) {\n this.setCollisionEndedCallbackEnabled(false);\n }\n if (this._nodeDisposeObserver) {\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\n this._nodeDisposeObserver = null;\n }\n this._physicsEngine.removeBody(this);\n this._physicsPlugin.removeBody(this);\n this._physicsPlugin.disposeBody(this);\n this.transformNode.physicsBody = null;\n this._pluginData = null;\n this._pluginDataInstances.length = 0;\n this._isDisposed = true;\n this.shape = null;\n }\n}","map":{"version":3,"names":["PhysicsPrestepType","Vector3","Quaternion","TmpVectors","PhysicsBody","disablePreStep","_prestepType","DISABLED","value","TELEPORT","constructor","transformNode","motionType","startsAsleep","scene","_pluginData","undefined","_pluginDataInstances","_collisionCBEnabled","_collisionEndedCBEnabled","disableSync","_isDisposed","_shape","physicsEngine","getPhysicsEngine","Error","_physicsEngine","getPluginVersion","physicsPlugin","getPhysicsPlugin","_physicsPlugin","rotationQuaternion","FromEulerAngles","rotation","x","y","z","startAsleep","_motionType","m","hasThinInstances","initBodyInstances","parent","computeWorldMatrix","initBody","absolutePosition","absoluteRotationQuaternion","physicsBody","addBody","_nodeDisposeObserver","onDisposeObservable","add","dispose","getClassName","clone","clonedBody","getMotionType","getScene","shape","setMassProperties","getMassProperties","setLinearDamping","getLinearDamping","setAngularDamping","getAngularDamping","updateBodyInstances","numInstances","length","setShape","getBoundingBox","getBodyBoundingBox","setEventMask","eventMask","instanceIndex","getEventMask","setMotionType","setPrestepType","prestepType","getPrestepType","computeMassProperties","massProps","damping","setLinearVelocity","linVel","getLinearVelocityToRef","getLinearVelocity","ref","setAngularVelocity","angVel","getAngularVelocityToRef","getAngularVelocity","applyImpulse","impulse","location","applyAngularImpulse","angularImpulse","applyForce","force","getGeometry","getBodyGeometry","getCollisionObservable","getCollisionEndedObservable","setCollisionCallbackEnabled","enabled","setCollisionEndedCallbackEnabled","getObjectCenterWorld","getObjectCenterWorldToRef","_this$_pluginDataInst","index","matrixData","_thinInstanceDataStorage","set","copyFrom","position","addConstraint","childBody","constraint","childInstanceIndex","syncWithBone","bone","boneMesh","jointPivot","distToJoint","adjustRotation","boneAxis","mesh","tempQuat","getRotationQuaternionToRef","multiplyToRef","pos","boneDir","getDirectionToRef","getAbsolutePositionToRef","setAbsolutePosition","iterateOverAllInstances","callback","_this$_pluginDataInst2","i","setGravityFactor","factor","getGravityFactor","setTargetTransform","isDisposed","remove","removeBody","disposeBody"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Physics/v2/physicsBody.js"],"sourcesContent":["import { PhysicsPrestepType } from \"./IPhysicsEnginePlugin.js\";\nimport { Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector.js\";\n/**\n * PhysicsBody is useful for creating a physics body that can be used in a physics engine. It allows\n * the user to set the mass and velocity of the body, which can then be used to calculate the\n * motion of the body in the physics engine.\n */\nexport class PhysicsBody {\n /**\n * Disable pre-step that consists in updating Physics Body from Transform Node Translation/Orientation.\n * True by default for maximum performance.\n */\n get disablePreStep() {\n return this._prestepType == PhysicsPrestepType.DISABLED;\n }\n set disablePreStep(value) {\n this._prestepType = value ? PhysicsPrestepType.DISABLED : PhysicsPrestepType.TELEPORT;\n }\n /**\n * Constructs a new physics body for the given node.\n * @param transformNode - The Transform Node to construct the physics body for. For better performance, it is advised that this node does not have a parent.\n * @param motionType - The motion type of the physics body. The options are:\n * - PhysicsMotionType.STATIC - Static bodies are not moving and unaffected by forces or collisions. They are good for level boundaries or terrain.\n * - PhysicsMotionType.DYNAMIC - Dynamic bodies are fully simulated. They can move and collide with other objects.\n * - PhysicsMotionType.ANIMATED - They behave like dynamic bodies, but they won't be affected by other bodies, but still push other bodies out of the way.\n * @param startsAsleep - Whether the physics body should start in a sleeping state (not a guarantee). Defaults to false.\n * @param scene - The scene containing the physics engine.\n *\n * This code is useful for creating a physics body for a given Transform Node in a scene.\n * It checks the version of the physics engine and the physics plugin, and initializes the body accordingly.\n * It also sets the node's rotation quaternion if it is not already set. Finally, it adds the body to the physics engine.\n */\n constructor(transformNode, motionType, startsAsleep, scene) {\n /**\n * V2 Physics plugin private data for single Transform\n */\n this._pluginData = undefined;\n /**\n * V2 Physics plugin private data for instances\n */\n this._pluginDataInstances = [];\n /**\n * If the collision callback is enabled\n */\n this._collisionCBEnabled = false;\n /**\n * If the collision ended callback is enabled\n */\n this._collisionEndedCBEnabled = false;\n /**\n * Disable sync from physics to transformNode. This value is set to true at body creation or at motionType setting when the body is not dynamic.\n */\n this.disableSync = false;\n this._isDisposed = false;\n this._shape = null;\n this._prestepType = PhysicsPrestepType.DISABLED;\n if (!scene) {\n return;\n }\n const physicsEngine = scene.getPhysicsEngine();\n if (!physicsEngine) {\n throw new Error(\"No Physics Engine available.\");\n }\n this._physicsEngine = physicsEngine;\n if (physicsEngine.getPluginVersion() != 2) {\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\n }\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\n if (!physicsPlugin) {\n throw new Error(\"No Physics Plugin available.\");\n }\n this._physicsPlugin = physicsPlugin;\n if (!transformNode.rotationQuaternion) {\n transformNode.rotationQuaternion = Quaternion.FromEulerAngles(transformNode.rotation.x, transformNode.rotation.y, transformNode.rotation.z);\n }\n this.startAsleep = startsAsleep;\n this._motionType = motionType;\n // only dynamic and animated body needs sync from physics to transformNode\n this.disableSync = motionType == 0 /* PhysicsMotionType.STATIC */;\n // instances?\n const m = transformNode;\n if (m.hasThinInstances) {\n this._physicsPlugin.initBodyInstances(this, motionType, m);\n }\n else {\n // single instance\n if (transformNode.parent) {\n // Force computation of world matrix so that the parent transforms are correctly reflected in absolutePosition/absoluteRotationQuaternion.\n transformNode.computeWorldMatrix(true);\n }\n this._physicsPlugin.initBody(this, motionType, transformNode.absolutePosition, transformNode.absoluteRotationQuaternion);\n }\n this.transformNode = transformNode;\n transformNode.physicsBody = this;\n physicsEngine.addBody(this);\n this._nodeDisposeObserver = transformNode.onDisposeObservable.add(() => {\n this.dispose();\n });\n }\n /**\n * Returns the string \"PhysicsBody\".\n * @returns \"PhysicsBody\"\n */\n getClassName() {\n return \"PhysicsBody\";\n }\n /**\n * Clone the PhysicsBody to a new body and assign it to the transformNode parameter\n * @param transformNode transformNode that will be used for the cloned PhysicsBody\n * @returns the newly cloned PhysicsBody\n */\n clone(transformNode) {\n const clonedBody = new PhysicsBody(transformNode, this.getMotionType(), this.startAsleep, this.transformNode.getScene());\n clonedBody.shape = this.shape;\n clonedBody.setMassProperties(this.getMassProperties());\n clonedBody.setLinearDamping(this.getLinearDamping());\n clonedBody.setAngularDamping(this.getAngularDamping());\n return clonedBody;\n }\n /**\n * If a physics body is connected to an instanced node, update the number physic instances to match the number of node instances.\n */\n updateBodyInstances() {\n const m = this.transformNode;\n if (m.hasThinInstances) {\n this._physicsPlugin.updateBodyInstances(this, m);\n }\n }\n /**\n * This returns the number of internal instances of the physics body\n */\n get numInstances() {\n return this._pluginDataInstances.length;\n }\n /**\n * Get the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\n */\n get motionType() {\n return this._motionType;\n }\n /**\n * Sets the shape of the physics body.\n * @param shape - The shape of the physics body.\n *\n * This method is useful for setting the shape of the physics body, which is necessary for the physics engine to accurately simulate the body's behavior.\n * The shape is used to calculate the body's mass, inertia, and other properties.\n */\n set shape(shape) {\n this._shape = shape;\n if (shape) {\n this._physicsPlugin.setShape(this, shape);\n }\n }\n /**\n * Retrieves the physics shape associated with this object.\n *\n * @returns The physics shape associated with this object, or `undefined` if no\n * shape is associated.\n *\n * This method is useful for retrieving the physics shape associated with this object,\n * which can be used to apply physical forces to the object or to detect collisions.\n */\n get shape() {\n return this._shape;\n }\n /**\n * Returns the bounding box of the physics body.\n * @returns The bounding box of the physics body.\n */\n getBoundingBox() {\n return this._physicsPlugin.getBodyBoundingBox(this);\n }\n /**\n * Sets the event mask for the physics engine.\n *\n * @param eventMask - A bitmask that determines which events will be sent to the physics engine.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the event mask for.\n *\n * This method is useful for setting the event mask for the physics engine, which determines which events\n * will be sent to the physics engine. This allows the user to control which events the physics engine will respond to.\n */\n setEventMask(eventMask, instanceIndex) {\n this._physicsPlugin.setEventMask(this, eventMask, instanceIndex);\n }\n /**\n * Gets the event mask of the physics engine.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the event mask for.\n * @returns The event mask of the physics engine.\n *\n * This method is useful for getting the event mask of the physics engine,\n * which is used to determine which events the engine will respond to.\n * This is important for ensuring that the engine is responding to the correct events and not\n * wasting resources on unnecessary events.\n */\n getEventMask(instanceIndex) {\n return this._physicsPlugin.getEventMask(this, instanceIndex);\n }\n /**\n * Sets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\n * @param motionType - The motion type to set.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the motion type for.\n */\n setMotionType(motionType, instanceIndex) {\n this.disableSync = motionType == 0 /* PhysicsMotionType.STATIC */;\n this._physicsPlugin.setMotionType(this, motionType, instanceIndex);\n }\n /**\n * Gets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the motion type for.\n * @returns The motion type of the physics body.\n */\n getMotionType(instanceIndex) {\n return this._physicsPlugin.getMotionType(this, instanceIndex);\n }\n /**\n * Set the prestep type of the body\n * @param prestepType prestep type provided by PhysicsPrestepType\n */\n setPrestepType(prestepType) {\n this._prestepType = prestepType;\n }\n /**\n * Get the current prestep type of the body\n * @returns the type of prestep associated with the body and its instance index\n */\n getPrestepType() {\n return this._prestepType;\n }\n /**\n * Computes the mass properties of the physics object, based on the set of physics shapes this body uses.\n * This method is useful for computing the initial mass properties of a physics object, such as its mass,\n * inertia, and center of mass; these values are important for accurately simulating the physics of the\n * object in the physics engine, and computing values based on the shape will provide you with reasonable\n * initial values, which you can then customize.\n * @param instanceIndex - The index of the instance to compute the mass properties for.\n * @returns The mass properties of the object.\n */\n computeMassProperties(instanceIndex) {\n return this._physicsPlugin.computeMassProperties(this, instanceIndex);\n }\n /**\n * Sets the mass properties of the physics object.\n *\n * @param massProps - The mass properties to set.\n * @param instanceIndex - The index of the instance to set the mass properties for. If not defined, the mass properties will be set for all instances.\n *\n * This method is useful for setting the mass properties of a physics object, such as its mass,\n * inertia, and center of mass. This is important for accurately simulating the physics of the object in the physics engine.\n */\n setMassProperties(massProps, instanceIndex) {\n this._physicsPlugin.setMassProperties(this, massProps, instanceIndex);\n }\n /**\n * Retrieves the mass properties of the object.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the mass properties for.\n * @returns The mass properties of the object.\n *\n * This method is useful for physics simulations, as it allows the user to\n * retrieve the mass properties of the object, such as its mass, center of mass,\n * and moment of inertia. This information is necessary for accurate physics\n * simulations.\n */\n getMassProperties(instanceIndex) {\n return this._physicsPlugin.getMassProperties(this, instanceIndex);\n }\n /**\n * Sets the linear damping of the physics body.\n *\n * @param damping - The linear damping value.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear damping for.\n *\n * This method is useful for controlling the linear damping of the physics body,\n * which is the rate at which the body's velocity decreases over time. This is useful for simulating\n * the effects of air resistance or other forms of friction.\n */\n setLinearDamping(damping, instanceIndex) {\n this._physicsPlugin.setLinearDamping(this, damping, instanceIndex);\n }\n /**\n * Gets the linear damping of the physics body.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear damping for.\n * @returns The linear damping of the physics body.\n *\n * This method is useful for retrieving the linear damping of the physics body, which is the amount of\n * resistance the body has to linear motion. This is useful for simulating realistic physics behavior\n * in a game.\n */\n getLinearDamping(instanceIndex) {\n return this._physicsPlugin.getLinearDamping(this, instanceIndex);\n }\n /**\n * Sets the angular damping of the physics body.\n * @param damping The angular damping of the body.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular damping for.\n *\n * This method is useful for controlling the angular velocity of a physics body.\n * By setting the damping, the body's angular velocity will be reduced over time, simulating the effect of friction.\n * This can be used to create realistic physical behavior in a physics engine.\n */\n setAngularDamping(damping, instanceIndex) {\n this._physicsPlugin.setAngularDamping(this, damping, instanceIndex);\n }\n /**\n * Gets the angular damping of the physics body.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular damping for.\n *\n * @returns The angular damping of the physics body.\n *\n * This method is useful for getting the angular damping of the physics body,\n * which is the rate of reduction of the angular velocity over time.\n * This is important for simulating realistic physics behavior in a game.\n */\n getAngularDamping(instanceIndex) {\n return this._physicsPlugin.getAngularDamping(this, instanceIndex);\n }\n /**\n * Sets the linear velocity of the physics object.\n * @param linVel - The linear velocity to set.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear velocity for.\n *\n * This method is useful for setting the linear velocity of a physics object,\n * which is necessary for simulating realistic physics in a game engine.\n * By setting the linear velocity, the physics object will move in the direction and speed specified by the vector.\n * This allows for realistic physics simulations, such as simulating the motion of a ball rolling down a hill.\n */\n setLinearVelocity(linVel, instanceIndex) {\n this._physicsPlugin.setLinearVelocity(this, linVel, instanceIndex);\n }\n /**\n * Gets the linear velocity of the physics body and stores it in the given vector3.\n * @param linVel - The vector3 to store the linear velocity in.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\n *\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\n */\n getLinearVelocityToRef(linVel, instanceIndex) {\n this._physicsPlugin.getLinearVelocityToRef(this, linVel, instanceIndex);\n }\n /**\n * Gets the linear velocity of the physics body as a new vector3.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\n * @returns The linear velocity of the physics body.\n *\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\n */\n getLinearVelocity(instanceIndex) {\n const ref = new Vector3();\n this.getLinearVelocityToRef(ref, instanceIndex);\n return ref;\n }\n /**\n * Sets the angular velocity of the physics object.\n * @param angVel - The angular velocity to set.\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular velocity for.\n *\n * This method is useful for setting the angular velocity of a physics object, which is necessary for\n * simulating realistic physics behavior. The angular velocity is used to determine the rate of rotation of the object,\n * which is important for simulating realistic motion.\n */\n setAngularVelocity(angVel, instanceIndex) {\n this._physicsPlugin.setAngularVelocity(this, angVel, instanceIndex);\n }\n /**\n * Gets the angular velocity of the physics body and stores it in the given vector3.\n * @param angVel - The vector3 to store the angular velocity in.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\n *\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\n * rotational speed. This information can be used to create realistic physics simulations.\n */\n getAngularVelocityToRef(angVel, instanceIndex) {\n this._physicsPlugin.getAngularVelocityToRef(this, angVel, instanceIndex);\n }\n /**\n * Gets the angular velocity of the physics body as a new vector3.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\n * @returns The angular velocity of the physics body.\n *\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\n * rotational speed. This information can be used to create realistic physics simulations.\n */\n getAngularVelocity(instanceIndex) {\n const ref = new Vector3();\n this.getAngularVelocityToRef(ref, instanceIndex);\n return ref;\n }\n /**\n * Applies an impulse to the physics object.\n *\n * @param impulse The impulse vector.\n * @param location The location of the impulse.\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\n *\n * This method is useful for applying an impulse to a physics object, which can be used to simulate physical forces such as gravity,\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\n */\n applyImpulse(impulse, location, instanceIndex) {\n this._physicsPlugin.applyImpulse(this, impulse, location, instanceIndex);\n }\n /**\n * Add torque to a physics body\n * @param angularImpulse The angular impulse vector.\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\n */\n applyAngularImpulse(angularImpulse, instanceIndex) {\n this._physicsPlugin.applyAngularImpulse(this, angularImpulse, instanceIndex);\n }\n /**\n * Applies a force to the physics object.\n *\n * @param force The force vector.\n * @param location The location of the force.\n * @param instanceIndex For a instanced body, the instance to where the force should be applied. If not specified, the force is applied to all instances.\n *\n * This method is useful for applying a force to a physics object, which can be used to simulate physical forces such as gravity,\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\n */\n applyForce(force, location, instanceIndex) {\n this._physicsPlugin.applyForce(this, force, location, instanceIndex);\n }\n /**\n * Retrieves the geometry of the body from the physics plugin.\n *\n * @returns The geometry of the body.\n *\n * This method is useful for retrieving the geometry of the body from the physics plugin, which can be used for various physics calculations.\n */\n getGeometry() {\n return this._physicsPlugin.getBodyGeometry(this);\n }\n /**\n * Returns an observable that will be notified for when a collision starts or continues for this PhysicsBody\n * @returns Observable\n */\n getCollisionObservable() {\n return this._physicsPlugin.getCollisionObservable(this);\n }\n /**\n * Returns an observable that will be notified when the body has finished colliding with another body\n * @returns\n */\n getCollisionEndedObservable() {\n return this._physicsPlugin.getCollisionEndedObservable(this);\n }\n /**\n * Enable or disable collision callback for this PhysicsBody.\n * @param enabled true if PhysicsBody's collision will rise a collision event and notifies the observable\n */\n setCollisionCallbackEnabled(enabled) {\n this._collisionCBEnabled = enabled;\n this._physicsPlugin.setCollisionCallbackEnabled(this, enabled);\n }\n /**\n * Enable or disable collision ended callback for this PhysicsBody.\n * @param enabled true if PhysicsBody's collision ended will rise a collision event and notifies the observable\n */\n setCollisionEndedCallbackEnabled(enabled) {\n this._collisionEndedCBEnabled = enabled;\n this._physicsPlugin.setCollisionEndedCallbackEnabled(this, enabled);\n }\n /**\n * Get the center of the object in world space.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\n * @returns geometric center of the associated mesh\n */\n getObjectCenterWorld(instanceIndex) {\n const ref = new Vector3();\n return this.getObjectCenterWorldToRef(ref, instanceIndex);\n }\n /**\n * Get the center of the object in world space.\n * @param ref - The vector3 to store the result in.\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\n * @returns geometric center of the associated mesh\n */\n getObjectCenterWorldToRef(ref, instanceIndex) {\n if (this._pluginDataInstances?.length > 0) {\n const index = instanceIndex || 0;\n const matrixData = this.transformNode._thinInstanceDataStorage.matrixData;\n if (matrixData) {\n ref.set(matrixData[index * 16 + 12], matrixData[index * 16 + 13], matrixData[index * 16 + 14]);\n }\n }\n else {\n ref.copyFrom(this.transformNode.position);\n }\n return ref;\n }\n /**\n * Adds a constraint to the physics engine.\n *\n * @param childBody - The body to which the constraint will be applied.\n * @param constraint - The constraint to be applied.\n * @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\n * @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\n *\n */\n addConstraint(childBody, constraint, instanceIndex, childInstanceIndex) {\n this._physicsPlugin.addConstraint(this, childBody, constraint, instanceIndex, childInstanceIndex);\n }\n /**\n * Sync with a bone\n * @param bone The bone that the impostor will be synced to.\n * @param boneMesh The mesh that the bone is influencing.\n * @param jointPivot The pivot of the joint / bone in local space.\n * @param distToJoint Optional distance from the impostor to the joint.\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\n * @param boneAxis Optional vector3 axis the bone is aligned with\n */\n syncWithBone(bone, boneMesh, jointPivot, distToJoint, adjustRotation, boneAxis) {\n const mesh = this.transformNode;\n if (mesh.rotationQuaternion) {\n if (adjustRotation) {\n const tempQuat = TmpVectors.Quaternion[0];\n bone.getRotationQuaternionToRef(1 /* Space.WORLD */, boneMesh, tempQuat);\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\n }\n else {\n bone.getRotationQuaternionToRef(1 /* Space.WORLD */, boneMesh, mesh.rotationQuaternion);\n }\n }\n const pos = TmpVectors.Vector3[0];\n const boneDir = TmpVectors.Vector3[1];\n if (!boneAxis) {\n boneAxis = TmpVectors.Vector3[2];\n boneAxis.x = 0;\n boneAxis.y = 1;\n boneAxis.z = 0;\n }\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\n bone.getAbsolutePositionToRef(boneMesh, pos);\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\n distToJoint = jointPivot.length();\n }\n if (distToJoint !== undefined && distToJoint !== null) {\n pos.x += boneDir.x * distToJoint;\n pos.y += boneDir.y * distToJoint;\n pos.z += boneDir.z * distToJoint;\n }\n mesh.setAbsolutePosition(pos);\n }\n /**\n * Executes a callback on the body or all of the instances of a body\n * @param callback the callback to execute\n */\n iterateOverAllInstances(callback) {\n if (this._pluginDataInstances?.length > 0) {\n for (let i = 0; i < this._pluginDataInstances.length; i++) {\n callback(this, i);\n }\n }\n else {\n callback(this, undefined);\n }\n }\n /**\n * Sets the gravity factor of the physics body\n * @param factor the gravity factor to set\n * @param instanceIndex the instance of the body to set, if undefined all instances will be set\n */\n setGravityFactor(factor, instanceIndex) {\n this._physicsPlugin.setGravityFactor(this, factor, instanceIndex);\n }\n /**\n * Gets the gravity factor of the physics body\n * @param instanceIndex the instance of the body to get, if undefined the value of first instance will be returned\n * @returns the gravity factor\n */\n getGravityFactor(instanceIndex) {\n return this._physicsPlugin.getGravityFactor(this, instanceIndex);\n }\n /**\n * Set the target transformation (position and rotation) of the body, such that the body will set its velocity to reach that target\n * @param position The target position\n * @param rotation The target rotation\n * @param instanceIndex The index of the instance in an instanced body\n */\n setTargetTransform(position, rotation, instanceIndex) {\n this._physicsPlugin.setTargetTransform(this, position, rotation, instanceIndex);\n }\n /**\n * Returns if the body has been disposed.\n * @returns true if disposed, false otherwise.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Disposes the body from the physics engine.\n *\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n // Disable collisions CB so it doesn't fire when the body is disposed\n if (this._collisionCBEnabled) {\n this.setCollisionCallbackEnabled(false);\n }\n if (this._collisionEndedCBEnabled) {\n this.setCollisionEndedCallbackEnabled(false);\n }\n if (this._nodeDisposeObserver) {\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\n this._nodeDisposeObserver = null;\n }\n this._physicsEngine.removeBody(this);\n this._physicsPlugin.removeBody(this);\n this._physicsPlugin.disposeBody(this);\n this.transformNode.physicsBody = null;\n this._pluginData = null;\n this._pluginDataInstances.length = 0;\n this._isDisposed = true;\n this.shape = null;\n }\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,OAAO,EAAEC,UAAU,EAAEC,UAAU,QAAQ,4BAA4B;AAC5E;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAC;EACrB;AACJ;AACA;AACA;E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