@adatechnology/game-weapons-three 0.11.0 → 0.11.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.
package/dist/index.js CHANGED
@@ -1616,9 +1616,7 @@ var HAND_HOLD = {
1616
1616
  /** How far the shooting hand slides on its grip so the thumb reaches the safety lever. */
1617
1617
  thumbReach: 0.02,
1618
1618
  /** How fast the supporting hand goes to the magazine and back, per second. */
1619
- magRate: 7,
1620
- /** The hands shrink with the tool: a tool drawn at scale `s` takes hands at `s ** handScaleExponent`. */
1621
- handScaleExponent: 0.55
1619
+ magRate: 7
1622
1620
  };
1623
1621
  var handFrame = (THREE, x, y) => {
1624
1622
  const ax = x.clone().normalize();
@@ -1708,7 +1706,8 @@ function holdOfModel(THREE, model, holderScale) {
1708
1706
  right,
1709
1707
  left,
1710
1708
  leftMagazine,
1711
- scale: holderScale ** HAND_HOLD.handScaleExponent,
1709
+ // the hands at the tool's scale: a tool drawn smaller than the hands looks like a toy in them
1710
+ scale: holderScale,
1712
1711
  grip: HAND_HOLD.closed,
1713
1712
  gripLeft: HAND_HOLD.forend
1714
1713
  };
@@ -1723,7 +1722,7 @@ function holdOfProp(THREE, group, category, scale) {
1723
1722
  const long = head && ["smg", "carbine", "rifle", "sniper", "shotgun", "crossbow", "flame"].includes(category);
1724
1723
  const headSize = head ? size(head) : null;
1725
1724
  const left = long && head && headSize ? { part: group, offset: head.position.clone().add(V(THREE, -headSize.x * 0.15, -headSize.y / 2 - HAND_HOLD.palm, 0)), quaternion: forendFrame(THREE) } : null;
1726
- return { right, left, leftMagazine: null, scale: scale ** HAND_HOLD.handScaleExponent, grip: HAND_HOLD.closed, gripLeft: HAND_HOLD.forend };
1725
+ return { right, left, leftMagazine: null, scale, grip: HAND_HOLD.closed, gripLeft: HAND_HOLD.forend };
1727
1726
  }
1728
1727
 
1729
1728
  // src/props.ts
@@ -7355,7 +7354,7 @@ function createViewmodel(options) {
7355
7354
  ahead.set(0, 0, -1).applyQuaternion(camera.quaternion);
7356
7355
  if (reach === 0) reach = Math.max(0.01, measureReach(session));
7357
7356
  const free = options.contact(camera.position, ahead, WALL_PULL.probe);
7358
- const want = free === null ? 0 : Math.max(0, Math.min(WALL_PULL.max, reach + WALL_PULL.margin - free));
7357
+ const want = free === null ? 0 : Math.max(0, Math.min(Math.max(WALL_PULL.max, session.lengthMetres * session.holderScale), reach + WALL_PULL.margin - free));
7359
7358
  pull += (want - pull) * Math.min(1, dt * WALL_PULL.rate);
7360
7359
  if (pull < 1e-4) return;
7361
7360
  hand.position.addScaledVector(ahead, -pull);