@adatechnology/game-vehicles-three 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49793,13 +49793,14 @@ var GameVehiclesThree = (() => {
49793
49793
  return { gauge: tracks.gauge, rearX: tracks.rearX - middle, frontX: tracks.frontX - middle, roadWheels: tracks.roadWheels, roadRadius: tracks.radius };
49794
49794
  };
49795
49795
  var RIDER_MASS_KG = 75;
49796
- var MOTORCYCLE_POWER_FACTOR = 1.3;
49797
49796
  var MOTORCYCLE_POWER_RATING_1 = 11800 / (132 + RIDER_MASS_KG);
49798
49797
  var MOTORCYCLE_POWER_RATING_10 = 33400 / (168 + RIDER_MASS_KG);
49799
- var motorcyclePower = (rating) => MOTORCYCLE_POWER_FACTOR * (MOTORCYCLE_POWER_RATING_1 + (MOTORCYCLE_POWER_RATING_10 - MOTORCYCLE_POWER_RATING_1) * (rating - 1) / 9);
49798
+ var motorcyclePower = (rating) => MOTORCYCLE_POWER_RATING_1 + (MOTORCYCLE_POWER_RATING_10 - MOTORCYCLE_POWER_RATING_1) * (rating - 1) / 9;
49799
+ var PHYSICS_TORQUE_SCALE = { car: 1.45, motorcycle: 1.3 };
49800
49800
  var carPower = (rating) => (0.06 + 0.015 * rating) * (defaultSemiSpec.engine.peakRpm * 2 * Math.PI / 60);
49801
+ var TRACKED_POWER = 20.05;
49801
49802
  var peakTorqueOf = (type, rating, mass, peakRpm) => {
49802
- const power = type === "motorcycle" ? motorcyclePower(rating) : carPower(rating);
49803
+ const power = type === "motorcycle" ? motorcyclePower(rating) : type === "tracked" ? TRACKED_POWER : carPower(rating);
49803
49804
  return mass * power * 60 / (2 * Math.PI * peakRpm);
49804
49805
  };
49805
49806
  var cyclistFor = (top, wheelRadius) => {
@@ -49855,6 +49856,7 @@ var GameVehiclesThree = (() => {
49855
49856
  gears,
49856
49857
  drag,
49857
49858
  brakeForce,
49859
+ ...type === "car" || type === "motorcycle" ? { physicsTorqueScale: PHYSICS_TORQUE_SCALE[type] } : {},
49858
49860
  tyre: { ...spec.tyre, friction: 0.8 + 0.03 * stats2.handling },
49859
49861
  ...pedal ? { pedal } : {},
49860
49862
  ...tracks ? { tracks } : {}
@@ -53554,11 +53556,13 @@ var GameVehiclesThree = (() => {
53554
53556
  [9, 6],
53555
53557
  [10, 4.2]
53556
53558
  ],
53559
+ accelerationSpanByType: { bicycle: [36, 120] },
53557
53560
  accelerationSpread: 0.35,
53558
53561
  topSpeedSpread: 0.1,
53559
53562
  dryBrake: { default: [6.5, 11], heavy: [4.5, 8.5], agricultural: [3.5, 7.5], military: [4.5, 9] },
53560
53563
  wetBrake: { default: [3.5, 8.5], heavy: [2.5, 7], agricultural: [2, 6], military: [2.5, 7] },
53561
- turnCircle: { default: [7, 13.5], motorcycles: [3, 9], suvs: [9, 15], pickups: [9, 16], vans: [9, 15], heavy: [10, 26], military: [9, 24], agricultural: [6, 16] },
53564
+ // a tracked vehicle pivots on the spot (one track forward, the other back: "neutral steering", https://en.wikipedia.org/wiki/Tank_steering_systems), so its circle can be a point: the band starts at 0
53565
+ turnCircle: { default: [7, 13.5], motorcycles: [3, 9], suvs: [9, 15], pickups: [9, 16], vans: [9, 15], heavy: [10, 26], military: [9, 24], agricultural: [6, 16], tracked: [0, 24] },
53562
53566
  mudFourWheelDrive: 10
53563
53567
  };
53564
53568
  var byClass = (table2, category) => table2[category] ?? table2.default;
@@ -53567,6 +53571,8 @@ var GameVehiclesThree = (() => {
53567
53571
  return base * (target / 100);
53568
53572
  };
53569
53573
  var accelerationRange = (table2, subject, target) => {
53574
+ const span = subject.body.type ? table2.accelerationSpanByType?.[subject.body.type] : void 0;
53575
+ if (span) return { min: round(span[0] * target / 100), max: round(span[1] * target / 100) };
53570
53576
  const t = expectedAcceleration(table2, subject, target);
53571
53577
  return { min: round(t * (1 - table2.accelerationSpread)), max: round(t * (1 + table2.accelerationSpread)) };
53572
53578
  };
@@ -53581,7 +53587,7 @@ var GameVehiclesThree = (() => {
53581
53587
  var dryBrakeRange = (table2, subject, kmh2) => brakeRange(byClass(table2.dryBrake, subject.category), kmh2);
53582
53588
  var wetBrakeRange = (table2, subject, kmh2) => brakeRange(byClass(table2.wetBrake, subject.category), kmh2);
53583
53589
  var turnCircleRange = (table2, subject) => {
53584
- const [min, max] = byClass(table2.turnCircle, subject.category);
53590
+ const [min, max] = byClass(table2.turnCircle, subject.body.type === "tracked" ? "tracked" : subject.category);
53585
53591
  return { min, max };
53586
53592
  };
53587
53593
  var inRange = (value, range2) => (range2.min == null || value >= range2.min) && (range2.max == null || value <= range2.max);