text: import { __extends } from "tslib";
  /**
   * This is a holder class for the physics joint created by the physics plugin
   * It holds a set of functions to control the underlying joint
   * @see https://doc.babylonjs.com/how_to/using_the_physics_engine
   */
  var PhysicsJoint = /** @class */ (function () {
      /**
       * Initializes the physics joint
       * @param type The type of the physics joint
       * @param jointData The data for the physics joint
       */
      function PhysicsJoint(
      /**
       * The type of the physics joint
       */
      type, 
      /**
       * The data for the physics joint
       */
      jointData) {
          this.type = type;
          this.jointData = jointData;
          jointData.nativeParams = jointData.nativeParams || {};
      }
      Object.defineProperty(PhysicsJoint.prototype, "physicsJoint", {
          /**
           * Gets the physics joint
           */
          get: function () {
              return this._physicsJoint;
          },
          /**
           * Sets the physics joint
           */
          set: function (newJoint) {
              if (this._physicsJoint) {
                  //remove from the wolrd
              }
              this._physicsJoint = newJoint;
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(PhysicsJoint.prototype, "physicsPlugin", {
          /**
           * Sets the physics plugin
           */
          set: function (physicsPlugin) {
              this._physicsPlugin = physicsPlugin;
          },
          enumerable: false,
          configurable: true
      });
      /**
       * Execute a function that is physics-plugin specific.
       * @param {Function} func the function that will be executed.
       *                        It accepts two parameters: the physics world and the physics joint
       */
      PhysicsJoint.prototype.executeNativeFunction = function (func) {
          func(this._physicsPlugin.world, this._physicsJoint);
      };
      //TODO check if the native joints are the same
      //Joint Types
      /**
       * Distance-Joint type
       */
      PhysicsJoint.DistanceJoint = 0;
      /**
       * Hinge-Joint type
       */
      PhysicsJoint.HingeJoint = 1;
      /**
       * Ball-and-Socket joint type
       */
      PhysicsJoint.BallAndSocketJoint = 2;
      /**
       * Wheel-Joint type
       */
      PhysicsJoint.WheelJoint = 3;
      /**
       * Slider-Joint type
       */
      PhysicsJoint.SliderJoint = 4;
      //OIMO
      /**
       * Prismatic-Joint type
       */
      PhysicsJoint.PrismaticJoint = 5;
      //
      /**
       * Universal-Joint type
       * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)
       */
      PhysicsJoint.UniversalJoint = 6;
      /**
       * Hinge-Joint 2 type
       */
      PhysicsJoint.Hinge2Joint = PhysicsJoint.WheelJoint;
      //Cannon
      /**
       * Point to Point Joint type.  Similar to a Ball-Joint.  Different in parameters
       */
      PhysicsJoint.PointToPointJoint = 8;
      //Cannon only at the moment
      /**
       * Spring-Joint type
       */
      PhysicsJoint.SpringJoint = 9;
      /**
       * Lock-Joint type
       */
      PhysicsJoint.LockJoint = 10;
      return PhysicsJoint;
  }());
  export { PhysicsJoint };
  /**
   * A class representing a physics distance joint
   * @see https://doc.babylonjs.com/how_to/using_the_physics_engine
   */
  var DistanceJoint = /** @class */ (function (_super) {
      __extends(DistanceJoint, _super);
      /**
       *
       * @param jointData The data for the Distance-Joint
       */
      function DistanceJoint(jointData) {
          return _super.call(this, PhysicsJoint.DistanceJoint, jointData) || this;
      }
      /**
       * Update the predefined distance.
       * @param maxDistance The maximum preferred distance
       * @param minDistance The minimum preferred distance
       */
      DistanceJoint.prototype.updateDistance = function (maxDistance, minDistance) {
          this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);
      };
      return DistanceJoint;
  }(PhysicsJoint));
  export { DistanceJoint };
  /**
   * Represents a Motor-Enabled Joint
   * @see https://doc.babylonjs.com/how_to/using_the_physics_engine
   */
  var MotorEnabledJoint = /** @class */ (function (_super) {
      __extends(MotorEnabledJoint, _super);
      /**
       * Initializes the Motor-Enabled Joint
       * @param type The type of the joint
       * @param jointData The physica joint data for the joint
       */
      function MotorEnabledJoint(type, jointData) {
          return _super.call(this, type, jointData) || this;
      }
      /**
       * Set the motor values.
       * Attention, this function is plugin specific. Engines won't react 100% the same.
       * @param force the force to apply
       * @param maxForce max force for this motor.
       */
      MotorEnabledJoint.prototype.setMotor = function (force, maxForce) {
          this._physicsPlugin.setMotor(this, force || 0, maxForce);
      };
      /**
       * Set the motor's limits.
       * Attention, this function is plugin specific. Engines won't react 100% the same.
       * @param upperLimit The upper limit of the motor
       * @param lowerLimit The lower limit of the motor
       */
      MotorEnabledJoint.prototype.setLimit = function (upperLimit, lowerLimit) {
          this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
      };
      return MotorEnabledJoint;
  }(PhysicsJoint));
  export { MotorEnabledJoint };
  /**
   * This class represents a single physics Hinge-Joint
   * @see https://doc.babylonjs.com/how_to/using_the_physics_engine
   */
  var HingeJoint = /** @class */ (function (_super) {
      __extends(HingeJoint, _super);
      /**
       * Initializes the Hinge-Joint
       * @param jointData The joint data for the Hinge-Joint
       */
      function HingeJoint(jointData) {
          return _super.call(this, PhysicsJoint.HingeJoint, jointData) || this;
      }
      /**
       * Set the motor values.
       * Attention, this function is plugin specific. Engines won't react 100% the same.
       * @param {number} force the force to apply
       * @param {number} maxForce max force for this motor.
       */
      HingeJoint.prototype.setMotor = function (force, maxForce) {
          this._physicsPlugin.setMotor(this, force || 0, maxForce);
      };
      /**
       * Set the motor's limits.
       * Attention, this function is plugin specific. Engines won't react 100% the same.
       * @param upperLimit The upper limit of the motor
       * @param lowerLimit The lower limit of the motor
       */
      HingeJoint.prototype.setLimit = function (upperLimit, lowerLimit) {
          this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
      };
      return HingeJoint;
  }(MotorEnabledJoint));
  export { HingeJoint };
  /**
   * This class represents a dual hinge physics joint (same as wheel joint)
   * @see https://doc.babylonjs.com/how_to/using_the_physics_engine
   */
  var Hinge2Joint = /** @class */ (function (_super) {
      __extends(Hinge2Joint, _super);
      /**
       * Initializes the Hinge2-Joint
       * @param jointData The joint data for the Hinge2-Joint
       */
      function Hinge2Joint(jointData) {
          return _super.call(this, PhysicsJoint.Hinge2Joint, jointData) || this;
      }
      /**
      * Set the motor values.
      * Attention, this function is plugin specific. Engines won't react 100% the same.
      * @param {number} targetSpeed the speed the motor is to reach
      * @param {number} maxForce max force for this motor.
      * @param {motorIndex} the motor's index, 0 or 1.
      */
      Hinge2Joint.prototype.setMotor = function (targetSpeed, maxForce, motorIndex) {
          if (motorIndex === void 0) { motorIndex = 0; }
          this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);
      };
      /**
       * Set the motor limits.
       * Attention, this function is plugin specific. Engines won't react 100% the same.
       * @param {number} upperLimit the upper limit
       * @param {number} lowerLimit lower limit
       * @param {motorIndex} the motor's index, 0 or 1.
       */
      Hinge2Joint.prototype.setLimit = function (upperLimit, lowerLimit, motorIndex) {
          if (motorIndex === void 0) { motorIndex = 0; }
          this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);
      };
      return Hinge2Joint;
  }(MotorEnabledJoint));
  export { Hinge2Joint };
  //# sourceMappingURL=physicsJoint.js.map