{"ast":null,"code":"/**\n * This is a holder class for the physics joint created by the physics plugin\n * It holds a set of functions to control the underlying joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class PhysicsJoint {\n /**\n * Initializes the physics joint\n * @param type The type of the physics joint\n * @param jointData The data for the physics joint\n */\n constructor(\n /**\n * The type of the physics joint\n */\n type,\n /**\n * The data for the physics joint\n */\n jointData) {\n this.type = type;\n this.jointData = jointData;\n jointData.nativeParams = jointData.nativeParams || {};\n }\n /**\n * Gets the physics joint\n */\n get physicsJoint() {\n return this._physicsJoint;\n }\n /**\n * Sets the physics joint\n */\n set physicsJoint(newJoint) {\n this._physicsJoint = newJoint;\n }\n /**\n * Sets the physics plugin\n */\n set physicsPlugin(physicsPlugin) {\n this._physicsPlugin = physicsPlugin;\n }\n /**\n * Execute a function that is physics-plugin specific.\n * @param {Function} func the function that will be executed.\n * It accepts two parameters: the physics world and the physics joint\n */\n executeNativeFunction(func) {\n func(this._physicsPlugin.world, this._physicsJoint);\n }\n}\n//TODO check if the native joints are the same\n//Joint Types\n/**\n * Distance-Joint type\n */\nPhysicsJoint.DistanceJoint = 0;\n/**\n * Hinge-Joint type\n */\nPhysicsJoint.HingeJoint = 1;\n/**\n * Ball-and-Socket joint type\n */\nPhysicsJoint.BallAndSocketJoint = 2;\n/**\n * Wheel-Joint type\n */\nPhysicsJoint.WheelJoint = 3;\n/**\n * Slider-Joint type\n */\nPhysicsJoint.SliderJoint = 4;\n//OIMO\n/**\n * Prismatic-Joint type\n */\nPhysicsJoint.PrismaticJoint = 5;\n//\n/**\n * Universal-Joint type\n * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)\n */\nPhysicsJoint.UniversalJoint = 6;\n/**\n * Hinge-Joint 2 type\n */\nPhysicsJoint.Hinge2Joint = PhysicsJoint.WheelJoint;\n//Cannon\n/**\n * Point to Point Joint type. Similar to a Ball-Joint. Different in parameters\n */\nPhysicsJoint.PointToPointJoint = 8;\n//Cannon only at the moment\n/**\n * Spring-Joint type\n */\nPhysicsJoint.SpringJoint = 9;\n/**\n * Lock-Joint type\n */\nPhysicsJoint.LockJoint = 10;\n/**\n * A class representing a physics distance joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class DistanceJoint extends PhysicsJoint {\n /**\n *\n * @param jointData The data for the Distance-Joint\n */\n constructor(jointData) {\n super(PhysicsJoint.DistanceJoint, jointData);\n }\n /**\n * Update the predefined distance.\n * @param maxDistance The maximum preferred distance\n * @param minDistance The minimum preferred distance\n */\n updateDistance(maxDistance, minDistance) {\n this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);\n }\n}\n/**\n * Represents a Motor-Enabled Joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class MotorEnabledJoint extends PhysicsJoint {\n /**\n * Initializes the Motor-Enabled Joint\n * @param type The type of the joint\n * @param jointData The physical joint data for the joint\n */\n constructor(type, jointData) {\n super(type, jointData);\n }\n /**\n * Set the motor values.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param force the force to apply\n * @param maxForce max force for this motor.\n */\n setMotor(force, maxForce) {\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\n }\n /**\n * Set the motor's limits.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param upperLimit The upper limit of the motor\n * @param lowerLimit The lower limit of the motor\n */\n setLimit(upperLimit, lowerLimit) {\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\n }\n}\n/**\n * This class represents a single physics Hinge-Joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class HingeJoint extends MotorEnabledJoint {\n /**\n * Initializes the Hinge-Joint\n * @param jointData The joint data for the Hinge-Joint\n */\n constructor(jointData) {\n super(PhysicsJoint.HingeJoint, jointData);\n }\n /**\n * Set the motor values.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param {number} force the force to apply\n * @param {number} maxForce max force for this motor.\n */\n setMotor(force, maxForce) {\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\n }\n /**\n * Set the motor's limits.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param upperLimit The upper limit of the motor\n * @param lowerLimit The lower limit of the motor\n */\n setLimit(upperLimit, lowerLimit) {\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\n }\n}\n/**\n * This class represents a dual hinge physics joint (same as wheel joint)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class Hinge2Joint extends MotorEnabledJoint {\n /**\n * Initializes the Hinge2-Joint\n * @param jointData The joint data for the Hinge2-Joint\n */\n constructor(jointData) {\n super(PhysicsJoint.Hinge2Joint, jointData);\n }\n /**\n * Set the motor values.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param targetSpeed the speed the motor is to reach\n * @param maxForce max force for this motor.\n * @param motorIndex motor's index, 0 or 1.\n */\n setMotor(targetSpeed, maxForce, motorIndex = 0) {\n this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);\n }\n /**\n * Set the motor limits.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param upperLimit the upper limit\n * @param lowerLimit lower limit\n * @param motorIndex the motor's index, 0 or 1.\n */\n setLimit(upperLimit, lowerLimit, motorIndex = 0) {\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);\n }\n}","map":{"version":3,"names":["PhysicsJoint","constructor","type","jointData","nativeParams","physicsJoint","_physicsJoint","newJoint","physicsPlugin","_physicsPlugin","executeNativeFunction","func","world","DistanceJoint","HingeJoint","BallAndSocketJoint","WheelJoint","SliderJoint","PrismaticJoint","UniversalJoint","Hinge2Joint","PointToPointJoint","SpringJoint","LockJoint","updateDistance","maxDistance","minDistance","updateDistanceJoint","MotorEnabledJoint","setMotor","force","maxForce","setLimit","upperLimit","lowerLimit","targetSpeed","motorIndex"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Physics/v1/physicsJoint.js"],"sourcesContent":["/**\n * This is a holder class for the physics joint created by the physics plugin\n * It holds a set of functions to control the underlying joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class PhysicsJoint {\n /**\n * Initializes the physics joint\n * @param type The type of the physics joint\n * @param jointData The data for the physics joint\n */\n constructor(\n /**\n * The type of the physics joint\n */\n type, \n /**\n * The data for the physics joint\n */\n jointData) {\n this.type = type;\n this.jointData = jointData;\n jointData.nativeParams = jointData.nativeParams || {};\n }\n /**\n * Gets the physics joint\n */\n get physicsJoint() {\n return this._physicsJoint;\n }\n /**\n * Sets the physics joint\n */\n set physicsJoint(newJoint) {\n this._physicsJoint = newJoint;\n }\n /**\n * Sets the physics plugin\n */\n set physicsPlugin(physicsPlugin) {\n this._physicsPlugin = physicsPlugin;\n }\n /**\n * Execute a function that is physics-plugin specific.\n * @param {Function} func the function that will be executed.\n * It accepts two parameters: the physics world and the physics joint\n */\n executeNativeFunction(func) {\n func(this._physicsPlugin.world, this._physicsJoint);\n }\n}\n//TODO check if the native joints are the same\n//Joint Types\n/**\n * Distance-Joint type\n */\nPhysicsJoint.DistanceJoint = 0;\n/**\n * Hinge-Joint type\n */\nPhysicsJoint.HingeJoint = 1;\n/**\n * Ball-and-Socket joint type\n */\nPhysicsJoint.BallAndSocketJoint = 2;\n/**\n * Wheel-Joint type\n */\nPhysicsJoint.WheelJoint = 3;\n/**\n * Slider-Joint type\n */\nPhysicsJoint.SliderJoint = 4;\n//OIMO\n/**\n * Prismatic-Joint type\n */\nPhysicsJoint.PrismaticJoint = 5;\n//\n/**\n * Universal-Joint type\n * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)\n */\nPhysicsJoint.UniversalJoint = 6;\n/**\n * Hinge-Joint 2 type\n */\nPhysicsJoint.Hinge2Joint = PhysicsJoint.WheelJoint;\n//Cannon\n/**\n * Point to Point Joint type. Similar to a Ball-Joint. Different in parameters\n */\nPhysicsJoint.PointToPointJoint = 8;\n//Cannon only at the moment\n/**\n * Spring-Joint type\n */\nPhysicsJoint.SpringJoint = 9;\n/**\n * Lock-Joint type\n */\nPhysicsJoint.LockJoint = 10;\n/**\n * A class representing a physics distance joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class DistanceJoint extends PhysicsJoint {\n /**\n *\n * @param jointData The data for the Distance-Joint\n */\n constructor(jointData) {\n super(PhysicsJoint.DistanceJoint, jointData);\n }\n /**\n * Update the predefined distance.\n * @param maxDistance The maximum preferred distance\n * @param minDistance The minimum preferred distance\n */\n updateDistance(maxDistance, minDistance) {\n this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);\n }\n}\n/**\n * Represents a Motor-Enabled Joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class MotorEnabledJoint extends PhysicsJoint {\n /**\n * Initializes the Motor-Enabled Joint\n * @param type The type of the joint\n * @param jointData The physical joint data for the joint\n */\n constructor(type, jointData) {\n super(type, jointData);\n }\n /**\n * Set the motor values.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param force the force to apply\n * @param maxForce max force for this motor.\n */\n setMotor(force, maxForce) {\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\n }\n /**\n * Set the motor's limits.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param upperLimit The upper limit of the motor\n * @param lowerLimit The lower limit of the motor\n */\n setLimit(upperLimit, lowerLimit) {\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\n }\n}\n/**\n * This class represents a single physics Hinge-Joint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class HingeJoint extends MotorEnabledJoint {\n /**\n * Initializes the Hinge-Joint\n * @param jointData The joint data for the Hinge-Joint\n */\n constructor(jointData) {\n super(PhysicsJoint.HingeJoint, jointData);\n }\n /**\n * Set the motor values.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param {number} force the force to apply\n * @param {number} maxForce max force for this motor.\n */\n setMotor(force, maxForce) {\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\n }\n /**\n * Set the motor's limits.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param upperLimit The upper limit of the motor\n * @param lowerLimit The lower limit of the motor\n */\n setLimit(upperLimit, lowerLimit) {\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\n }\n}\n/**\n * This class represents a dual hinge physics joint (same as wheel joint)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\n */\nexport class Hinge2Joint extends MotorEnabledJoint {\n /**\n * Initializes the Hinge2-Joint\n * @param jointData The joint data for the Hinge2-Joint\n */\n constructor(jointData) {\n super(PhysicsJoint.Hinge2Joint, jointData);\n }\n /**\n * Set the motor values.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param targetSpeed the speed the motor is to reach\n * @param maxForce max force for this motor.\n * @param motorIndex motor's index, 0 or 1.\n */\n setMotor(targetSpeed, maxForce, motorIndex = 0) {\n this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);\n }\n /**\n * Set the motor limits.\n * Attention, this function is plugin specific. Engines won't react 100% the same.\n * @param upperLimit the upper limit\n * @param lowerLimit lower limit\n * @param motorIndex the motor's index, 0 or 1.\n */\n setLimit(upperLimit, lowerLimit, motorIndex = 0) {\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,CAAC;EACtB;AACJ;AACA;AACA;AACA;EACIC,WAAWA;EACX;AACJ;AACA;EACIC,IAAI;EACJ;AACJ;AACA;EACIC,SAAS,EAAE;IACP,IAAI,CAACD,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,SA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