roavatar-renderer 1.8.1 → 1.9.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.d.ts CHANGED
@@ -72,6 +72,11 @@ export declare class AccessoryWrapper extends InstanceWrapper {
72
72
  static requiredProperties: string[];
73
73
  setup(): void;
74
74
  created(): void;
75
+ /**
76
+ *
77
+ * @returns [bodyAttachment, handleAttachment] or undefined
78
+ */
79
+ getBodyAccessoryAttachmentPair(): [Instance, Instance] | undefined;
75
80
  AccessoryBuildWeld(): void;
76
81
  }
77
82
 
@@ -431,6 +436,7 @@ export declare class Assembly {
431
436
  rootNode: AssemblyNode;
432
437
  allNodes: AssemblyNode[] | undefined;
433
438
  allConnectors: Instance[] | undefined;
439
+ linearVelocity: Vector3;
434
440
  constructor(rootPart: Instance);
435
441
  getNodeDescendants(): AssemblyNode[];
436
442
  getPartDescendants(): Instance[];
@@ -1655,6 +1661,8 @@ export declare const FLAGS: {
1655
1661
  * @deprecated This can now be set per-scene
1656
1662
  * */
1657
1663
  PARTICLES_START_FULL_FRAMERATE: number;
1664
+ /**amount of segments a trail can create per second */
1665
+ TRAIL_FPS: number;
1658
1666
  /**shows ThreeJS SkeletonHelper */
1659
1667
  SHOW_SKELETON_HELPER: boolean;
1660
1668
  /**if set the skeleton helper will only show if the instance has the name */
@@ -1891,7 +1899,7 @@ export declare function getOffsetArray(inner: FileMesh, outer: FileMesh): ([Vec3
1891
1899
 
1892
1900
  export declare function getOriginalAttachmentOrientation(attachment: Instance): Vector3;
1893
1901
 
1894
- export declare function getOriginalAttachmentPosition(attachment: Instance): Vector3;
1902
+ export declare function getOriginalAttachmentPosition(attachment: Instance, currentScale: Vector3): Vector3;
1895
1903
 
1896
1904
  export declare function getOriginalSize(part: Instance): Vector3;
1897
1905
 
@@ -2732,7 +2740,16 @@ export declare class ModelWrapper extends InstanceWrapper {
2732
2740
  /**
2733
2741
  * @category InstanceWrapper
2734
2742
  */
2735
- export declare class Motor6DWrapper extends JointInstanceWrapper {
2743
+ export declare class Motor6DWrapper extends MotorWrapper {
2744
+ static className: string;
2745
+ static requiredProperties: string[];
2746
+ setup(): void;
2747
+ }
2748
+
2749
+ /**
2750
+ * @category InstanceWrapper
2751
+ */
2752
+ declare class MotorWrapper extends JointInstanceWrapper {
2736
2753
  static className: string;
2737
2754
  static requiredProperties: string[];
2738
2755
  setup(): void;
@@ -3103,6 +3120,8 @@ export declare class OutfitRenderer {
3103
3120
  doCameraUpdateOnLoad: boolean; /**Makes camera update when new avatar has loaded */
3104
3121
  doCameraUpdate: boolean; /**Does camera update every frame */
3105
3122
  doAddInstance: boolean; /**If outfitRenderer should call RBXRenderer.addInstance(), setting this to false will make OutfitRenderer return success early */
3123
+ doMoveLoose: boolean; /**If outfitRenderer should call this.moveLoose() when certain animations are playing */
3124
+ affectsLinearVelocity: boolean; /**If outfitRenderer should set the AssemblyLinearVelocity every animateOnce */
3106
3125
  forceAnimationLoop: boolean; /**If future loaded animations should be set to loop */
3107
3126
  backgroundRenderer: BackgroundRenderer;
3108
3127
  currentlyChangingRig: boolean;
@@ -3177,10 +3196,12 @@ export declare class OutfitRenderer {
3177
3196
  * Starts updating the animation of the outfit per frame
3178
3197
  */
3179
3198
  startAnimating(): void;
3199
+ /**Animates moveLoose */
3200
+ animateMoveLoose(deltaTime: number): void;
3180
3201
  /**
3181
3202
  * Updates the animation once
3182
3203
  */
3183
- animateOnce(deltaTimeOverride?: number): void;
3204
+ animateOnce(deltaTimeOverride?: number, forceTime?: number, forceKeyframe?: number): void;
3184
3205
  /**
3185
3206
  * Stops updating the animation of the outfit per frame
3186
3207
  */
@@ -3208,6 +3229,10 @@ export declare class OutfitRenderer {
3208
3229
  * Updates rendered particles so they face the camera without simulating them (usually used when generating thumbnails)
3209
3230
  */
3210
3231
  updateParticleMatrix(): void;
3232
+ /**
3233
+ * Moves "loose" things such as particles and trails by the Vec3 given, used to simulate character movement without actually moving the character
3234
+ */
3235
+ moveLoose(vec: Vec3): void;
3211
3236
  /**Calls destroy on the rig, stops animating and disconnects connections. The OutfitRenderer should not be interacted with after this */
3212
3237
  destroy(): void;
3213
3238
  }
@@ -3724,6 +3749,7 @@ declare class RenderDesc extends DisposableDesc {
3724
3749
  fromInstance(_child: Instance): void;
3725
3750
  compileResults(_renderer: THREE.WebGLRenderer, _scene: THREE.Scene): Promise<THREE.Object3D[] | Response | undefined>;
3726
3751
  updateResults(): void;
3752
+ moveLoose(_diff: Vec3): void;
3727
3753
  static shouldRenderInstance(_instance: Instance): boolean;
3728
3754
  static register(): void;
3729
3755
  static(): typeof RenderDesc;
@@ -3859,6 +3885,7 @@ export declare class ScriptWrapper extends InstanceWrapper {
3859
3885
  Run(): void;
3860
3886
  SoundPlayer(script: Instance): Promise<void>;
3861
3887
  HatScript20(script: Instance): Promise<void>;
3888
+ TrailTestRoAvatar(script: Instance): Promise<void>;
3862
3889
  }
3863
3890
 
3864
3891
  declare class ScriptWrapperData {
package/dist/index.js CHANGED
@@ -32629,6 +32629,7 @@ const FLAGS = {
32629
32629
  RENDERER_DELTA_TIME_MULTIPLIER: 1,
32630
32630
  PARTICLES_START_FULL: 0,
32631
32631
  PARTICLES_START_FULL_FRAMERATE: 20,
32632
+ TRAIL_FPS: 30,
32632
32633
  //skeleton
32633
32634
  SHOW_SKELETON_HELPER: false,
32634
32635
  SKELETON_HELPER_INSTANCE_NAME: void 0,
@@ -43930,6 +43931,9 @@ class RenderDesc extends DisposableDesc {
43930
43931
  throw new Error("Virtual method updateResults called");
43931
43932
  }
43932
43933
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
43934
+ moveLoose(_diff2) {
43935
+ }
43936
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
43933
43937
  static shouldRenderInstance(_instance) {
43934
43938
  return true;
43935
43939
  }
@@ -44075,6 +44079,7 @@ class Assembly {
44075
44079
  rootNode;
44076
44080
  allNodes;
44077
44081
  allConnectors;
44082
+ linearVelocity = new Vector3(0, 0, 0);
44078
44083
  constructor(rootPart) {
44079
44084
  const checked = [rootPart];
44080
44085
  let depth = 0;
@@ -44159,8 +44164,12 @@ class AccessoryWrapper extends InstanceWrapper {
44159
44164
  this.AccessoryBuildWeld();
44160
44165
  });
44161
44166
  }
44162
- AccessoryBuildWeld() {
44163
- if (this.instance.parent && this.instance.className === "Accessory") {
44167
+ /**
44168
+ *
44169
+ * @returns [bodyAttachment, handleAttachment] or undefined
44170
+ */
44171
+ getBodyAccessoryAttachmentPair() {
44172
+ if (this.instance.parent) {
44164
44173
  const humanoid = this.instance.parent.FindFirstChildOfClass("Humanoid");
44165
44174
  if (humanoid) {
44166
44175
  const handle = this.instance.FindFirstChild("Handle");
@@ -44179,27 +44188,51 @@ class AccessoryWrapper extends InstanceWrapper {
44179
44188
  }
44180
44189
  }
44181
44190
  }
44182
- if (!bodyAttachment) {
44183
- return;
44184
- }
44185
- if (!accessoryAttachment) {
44186
- return;
44187
- }
44191
+ if (bodyAttachment && accessoryAttachment) return [bodyAttachment, accessoryAttachment];
44192
+ }
44193
+ }
44194
+ }
44195
+ }
44196
+ AccessoryBuildWeld() {
44197
+ if (this.instance.parent && this.instance.className === "Accessory") {
44198
+ const humanoid = this.instance.parent.FindFirstChildOfClass("Humanoid");
44199
+ if (humanoid) {
44200
+ const handle = this.instance.FindFirstChild("Handle");
44201
+ if (handle) {
44202
+ const attachmentPair = this.getBodyAccessoryAttachmentPair();
44188
44203
  const oldAccessoryWeld = handle.FindFirstChild("AccessoryWeld");
44189
44204
  if (oldAccessoryWeld) {
44190
44205
  oldAccessoryWeld.Destroy();
44191
44206
  }
44192
- const weld = new Instance("Weld");
44193
- weld.addProperty(new Property("Name", DataType.String), "AccessoryWeld");
44194
- weld.addProperty(new Property("Archivable", DataType.Bool), true);
44195
- weld.addProperty(new Property("C1", DataType.CFrame), accessoryAttachment.Property("CFrame").clone());
44196
- weld.addProperty(new Property("C0", DataType.CFrame), bodyAttachment.Property("CFrame").clone());
44197
- weld.addProperty(new Property("Part1", DataType.Referent), accessoryAttachment.parent);
44198
- weld.addProperty(new Property("Part0", DataType.Referent), bodyAttachment.parent);
44199
- weld.addProperty(new Property("Active", DataType.Bool), true);
44200
- weld.addProperty(new Property("Enabled", DataType.Bool), false);
44201
- weld.setParent(handle);
44202
- weld.setProperty("Enabled", true);
44207
+ if (attachmentPair) {
44208
+ const [bodyAttachment, accessoryAttachment] = attachmentPair;
44209
+ const weld = new Instance("Weld");
44210
+ weld.addProperty(new Property("Name", DataType.String), "AccessoryWeld");
44211
+ weld.addProperty(new Property("Archivable", DataType.Bool), true);
44212
+ weld.addProperty(new Property("C1", DataType.CFrame), accessoryAttachment.Property("CFrame").clone());
44213
+ weld.addProperty(new Property("C0", DataType.CFrame), bodyAttachment.Property("CFrame").clone());
44214
+ weld.addProperty(new Property("Part1", DataType.Referent), accessoryAttachment.parent);
44215
+ weld.addProperty(new Property("Part0", DataType.Referent), bodyAttachment.parent);
44216
+ weld.addProperty(new Property("Active", DataType.Bool), true);
44217
+ weld.addProperty(new Property("Enabled", DataType.Bool), false);
44218
+ weld.setParent(handle);
44219
+ weld.setProperty("Enabled", true);
44220
+ } else {
44221
+ const head = this.instance.parent.FindFirstChild("Head");
44222
+ if (!head) return;
44223
+ const attachmentPoint = this.instance.PropOrDefault("AttachmentPoint", new CFrame());
44224
+ const weld = new Instance("Weld");
44225
+ weld.addProperty(new Property("Name", DataType.String), "AccessoryWeld");
44226
+ weld.addProperty(new Property("Archivable", DataType.Bool), true);
44227
+ weld.addProperty(new Property("C1", DataType.CFrame), attachmentPoint.clone());
44228
+ weld.addProperty(new Property("C0", DataType.CFrame), new CFrame());
44229
+ weld.addProperty(new Property("Part1", DataType.Referent), handle);
44230
+ weld.addProperty(new Property("Part0", DataType.Referent), head);
44231
+ weld.addProperty(new Property("Active", DataType.Bool), true);
44232
+ weld.addProperty(new Property("Enabled", DataType.Bool), false);
44233
+ weld.setParent(handle);
44234
+ weld.setProperty("Enabled", true);
44235
+ }
44203
44236
  }
44204
44237
  }
44205
44238
  }
@@ -44459,9 +44492,9 @@ function getOriginalSize(part) {
44459
44492
  }
44460
44493
  return originalSize;
44461
44494
  }
44462
- function scaleChildrenOfPart(part, scaleVector, scaleAttachment = true) {
44495
+ function scaleChildrenOfPart(part, scaleVector, alreadyScaledAttachment) {
44463
44496
  for (const child of part.GetDescendants()) {
44464
- if (child.className === "Attachment" && scaleAttachment) {
44497
+ if (child.className === "Attachment" && child !== alreadyScaledAttachment) {
44465
44498
  let originalPosition = child.Prop("Position");
44466
44499
  originalPosition = originalPosition.multiply(scaleVector);
44467
44500
  const newCF = child.Prop("CFrame").clone();
@@ -44475,10 +44508,11 @@ function scaleChildrenOfPart(part, scaleVector, scaleAttachment = true) {
44475
44508
  }
44476
44509
  }
44477
44510
  }
44478
- function originalChildrenOfPart(part) {
44511
+ function originalChildrenOfPart(part, originalSize, currentSize) {
44512
+ const currentScale = currentSize.divide(originalSize);
44479
44513
  for (const child of part.GetDescendants()) {
44480
44514
  if (child.className === "Attachment") {
44481
- const originalPosition = getOriginalAttachmentPosition(child);
44515
+ const originalPosition = getOriginalAttachmentPosition(child, currentScale);
44482
44516
  const originalOrientation = getOriginalAttachmentOrientation(child);
44483
44517
  const newCF = child.Prop("CFrame").clone();
44484
44518
  newCF.Position = [originalPosition.X, originalPosition.Y, originalPosition.Z];
@@ -44486,7 +44520,7 @@ function originalChildrenOfPart(part) {
44486
44520
  child.setProperty("CFrame", newCF);
44487
44521
  } else if (child.className === "SpecialMesh") {
44488
44522
  if (child.Prop("MeshType") !== MeshType.Head) {
44489
- const orignalScale = getOriginalMeshScale(child);
44523
+ const orignalScale = getOriginalMeshScale(child, currentScale);
44490
44524
  child.setProperty("Scale", orignalScale);
44491
44525
  }
44492
44526
  }
@@ -44577,32 +44611,36 @@ function ScaleAccessory(accessory, bodyScaleVector, headScaleVector, bodyTypeSca
44577
44611
  } else {
44578
44612
  warn(false, "Failed to find attached part for accessory:", accessory);
44579
44613
  }
44580
- originalChildrenOfPart(handle);
44581
44614
  const originalSize = getOriginalSize(handle);
44582
- let hasAdjusted = false;
44615
+ originalChildrenOfPart(handle, originalSize, handle.Prop("Size"));
44616
+ let hasAdjusted = void 0;
44617
+ let attachmentPair = void 0;
44583
44618
  const accessoryDescs = humanoidDescription.GetChildren();
44584
44619
  for (const accessoryDesc of accessoryDescs) {
44585
44620
  if (accessoryDesc.className === "AccessoryDescription") {
44586
- if (accessoryDesc.Prop("Instance") === accessory) {
44587
- const attachment = handle.FindFirstChildOfClass("Attachment");
44588
- if (attachment) {
44589
- hasAdjusted = true;
44590
- adjustAttachment(attachment, accessoryDesc.Prop("Position"), accessoryDesc.Prop("Rotation"), accessoryDesc.Prop("Scale"), resultScale);
44621
+ if (accessoryDesc.Prop("Instance") === accessory && accessory.IsA("Accessory")) {
44622
+ const accessoryW = accessory.w;
44623
+ attachmentPair = accessoryW.getBodyAccessoryAttachmentPair();
44624
+ if (attachmentPair) {
44625
+ const handleAttachment = attachmentPair[1];
44626
+ hasAdjusted = handleAttachment;
44627
+ adjustAttachment(handleAttachment, accessoryDesc.Prop("Position"), accessoryDesc.Prop("Rotation"), accessoryDesc.Prop("Scale"), resultScale);
44591
44628
  }
44592
44629
  const adjustScale = accessoryDesc.Prop("Scale");
44593
44630
  resultScale = resultScale.multiply(adjustScale);
44594
44631
  }
44595
44632
  }
44596
44633
  }
44597
- scaleChildrenOfPart(handle, resultScale, !hasAdjusted);
44634
+ scaleChildrenOfPart(handle, resultScale, hasAdjusted);
44598
44635
  handle.setProperty("Size", originalSize.multiply(resultScale));
44599
44636
  if (accessory.className === "Accessory") {
44600
44637
  const accessoryWrapper = new AccessoryWrapper(accessory);
44601
44638
  accessoryWrapper.AccessoryBuildWeld();
44602
44639
  }
44603
44640
  }
44604
- function getOriginalMeshScale(mesh) {
44641
+ function getOriginalMeshScale(mesh, currentScale) {
44605
44642
  let originalScale = mesh.Prop("Scale");
44643
+ originalScale = originalScale.divide(currentScale);
44606
44644
  const originalScaleValue = mesh.FindFirstChild(originalSizeName);
44607
44645
  if (originalScaleValue) {
44608
44646
  originalScale = originalScaleValue.Prop("Value");
@@ -44614,12 +44652,13 @@ function getOriginalMeshScale(mesh) {
44614
44652
  }
44615
44653
  return originalScale;
44616
44654
  }
44617
- function getOriginalAttachmentPosition(attachment) {
44655
+ function getOriginalAttachmentPosition(attachment, currentScale) {
44618
44656
  const originalPosition = attachment.FindFirstChild(originalPositionName);
44619
44657
  if (originalPosition) {
44620
44658
  return originalPosition.Prop("Value");
44621
44659
  }
44622
- const position = attachment.Prop("Position");
44660
+ let position = attachment.Prop("Position");
44661
+ position = position.divide(currentScale);
44623
44662
  const attachmentLocationValue = new Instance("Vector3Value");
44624
44663
  attachmentLocationValue.addProperty(new Property("Name", DataType.String), originalPositionName);
44625
44664
  attachmentLocationValue.addProperty(new Property("Value", DataType.Vector3), position);
@@ -44640,7 +44679,9 @@ function getOriginalAttachmentOrientation(attachment) {
44640
44679
  }
44641
44680
  function ScaleCharacterPart(part, bodyScaleVector, headScaleVector, anthroPercent, wideToNarrow) {
44642
44681
  const partName = part.Prop("Name");
44682
+ const currentSize = part.Prop("Size");
44643
44683
  const originalSize = getOriginalSize(part);
44684
+ const currentScale = currentSize.divide(originalSize);
44644
44685
  let newScaleVector = bodyScaleVector;
44645
44686
  if (partName == "Head") {
44646
44687
  newScaleVector = headScaleVector;
@@ -44690,7 +44731,7 @@ function ScaleCharacterPart(part, bodyScaleVector, headScaleVector, anthroPercen
44690
44731
  if (mesh.Prop("MeshType") == MeshType.Head) {
44691
44732
  headScale = Vector3.new(1, 1, 1);
44692
44733
  }
44693
- const originalScale = getOriginalMeshScale(mesh);
44734
+ const originalScale = getOriginalMeshScale(mesh, currentScale);
44694
44735
  if (mesh.Prop("MeshType") !== MeshType.Head) {
44695
44736
  mesh.setProperty("Scale", originalScale.multiply(scale).multiply(headScale));
44696
44737
  }
@@ -44720,7 +44761,7 @@ function ScaleCharacterPart(part, bodyScaleVector, headScaleVector, anthroPercen
44720
44761
  part.setProperty("Size", originalSize.multiply(scale).multiply(newScaleVector));
44721
44762
  for (const child of part.GetDescendants()) {
44722
44763
  if (child.className === "Attachment") {
44723
- const originalAttachment = getOriginalAttachmentPosition(child);
44764
+ const originalAttachment = getOriginalAttachmentPosition(child, currentScale);
44724
44765
  const ogCF = child.Prop("CFrame").clone();
44725
44766
  const newPos = originalAttachment.multiply(scale).multiply(newScaleVector);
44726
44767
  ogCF.Position = [newPos.X, newPos.Y, newPos.Z];
@@ -48094,7 +48135,7 @@ class BasePartWrapper extends InstanceWrapper {
48094
48135
  return connected;
48095
48136
  }
48096
48137
  }
48097
- const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48138
+ const __vite_glob_0_5$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48098
48139
  __proto__: null,
48099
48140
  BasePartWrapper
48100
48141
  }, Symbol.toStringTag, { value: "Module" }));
@@ -51922,7 +51963,20 @@ const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
51922
51963
  __proto__: null,
51923
51964
  ModelWrapper
51924
51965
  }, Symbol.toStringTag, { value: "Module" }));
51925
- class Motor6DWrapper extends JointInstanceWrapper {
51966
+ class MotorWrapper extends JointInstanceWrapper {
51967
+ static className = "Motor";
51968
+ static requiredProperties = [
51969
+ ...super.requiredProperties
51970
+ ];
51971
+ setup() {
51972
+ super.setup();
51973
+ }
51974
+ }
51975
+ const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51976
+ __proto__: null,
51977
+ MotorWrapper
51978
+ }, Symbol.toStringTag, { value: "Module" }));
51979
+ class Motor6DWrapper extends MotorWrapper {
51926
51980
  static className = "Motor6D";
51927
51981
  static requiredProperties = [
51928
51982
  ...super.requiredProperties,
@@ -51933,7 +51987,7 @@ class Motor6DWrapper extends JointInstanceWrapper {
51933
51987
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
51934
51988
  }
51935
51989
  }
51936
- const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51990
+ const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51937
51991
  __proto__: null,
51938
51992
  Motor6DWrapper
51939
51993
  }, Symbol.toStringTag, { value: "Module" }));
@@ -51948,7 +52002,7 @@ class PartWrapper extends BasePartWrapper {
51948
52002
  if (!this.instance.HasProperty("shape")) this.instance.addProperty(new Property("shape", DataType.Enum), PartType.Block);
51949
52003
  }
51950
52004
  }
51951
- const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52005
+ const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51952
52006
  __proto__: null,
51953
52007
  PartWrapper
51954
52008
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52417,7 +52471,7 @@ class EmitterDesc extends DisposableDesc {
52417
52471
  const velocityOriginal = new Vector3$1(...velocityFront.toVec3()).multiply(velocityMultiplier);
52418
52472
  const velocityLocal = velocityOriginal.applyQuaternion(groupDesc.getNormalQuaternionForVelocity());
52419
52473
  const worldVelocity = velocityLocal.applyQuaternion(new Quaternion().setFromRotationMatrix(groupDesc.cframe.getTHREEMatrix()));
52420
- const worldVelocityRoblox = new Vector3(...worldVelocity.toArray());
52474
+ const worldVelocityRoblox = new Vector3(...worldVelocity.toArray()).add(groupDesc.parentVelocity);
52421
52475
  let localPos = groupDesc.getRandomLocalPos();
52422
52476
  localPos = localPos.add(this.offset);
52423
52477
  const worldPos = groupDesc.toWorldSpace(localPos);
@@ -52527,6 +52581,7 @@ class EmitterGroupDesc extends RenderDesc {
52527
52581
  lastCframe = new CFrame();
52528
52582
  cframe = new CFrame();
52529
52583
  emitterDir = NormalId.Top;
52584
+ parentVelocity = new Vector3();
52530
52585
  emitterDescs = [];
52531
52586
  //special for emitter group
52532
52587
  getRandomLocalPos() {
@@ -52626,6 +52681,15 @@ class EmitterGroupDesc extends RenderDesc {
52626
52681
  this.higherBound = size.multiply(new Vector3(0.5, 0.5, 0.5));
52627
52682
  this.lowerBound = size.multiply(new Vector3(-0.5, -0.5, -0.5));
52628
52683
  }
52684
+ let lastParent = parent;
52685
+ while (lastParent) {
52686
+ if (lastParent.IsA("BasePart")) {
52687
+ const assembly = lastParent.w.GetAssembly();
52688
+ this.parentVelocity = assembly.linearVelocity.clone();
52689
+ break;
52690
+ }
52691
+ lastParent = lastParent.parent;
52692
+ }
52629
52693
  }
52630
52694
  this.enabled = child.PropOrDefault("Enabled", true);
52631
52695
  const className = child.className;
@@ -52836,6 +52900,14 @@ class EmitterGroupDesc extends RenderDesc {
52836
52900
  }
52837
52901
  this.lastCframe = this.cframe.clone();
52838
52902
  }
52903
+ moveLoose(vec) {
52904
+ for (const emitterDesc of this.emitterDescs) {
52905
+ if (emitterDesc.lockedToPart) continue;
52906
+ for (const particle of emitterDesc.particles) {
52907
+ particle.position = particle.position.add(new Vector3().fromVec3(vec));
52908
+ }
52909
+ }
52910
+ }
52839
52911
  }
52840
52912
  const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52841
52913
  __proto__: null,
@@ -52862,7 +52934,7 @@ class ParticleEmitterWrapper extends InstanceWrapper {
52862
52934
  }
52863
52935
  }
52864
52936
  }
52865
- const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52937
+ const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52866
52938
  __proto__: null,
52867
52939
  ParticleEmitterWrapper
52868
52940
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52968,7 +53040,7 @@ class SoundWrapper extends InstanceWrapper {
52968
53040
  }
52969
53041
  }
52970
53042
  }
52971
- const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53043
+ const __vite_glob_0_25 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52972
53044
  __proto__: null,
52973
53045
  SoundWrapper
52974
53046
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52998,6 +53070,9 @@ class ScriptWrapper extends InstanceWrapper {
52998
53070
  case "HatScript2.0":
52999
53071
  this.HatScript20(this.instance);
53000
53072
  break;
53073
+ case "TrailTestRoAvatar":
53074
+ this.TrailTestRoAvatar(this.instance);
53075
+ break;
53001
53076
  }
53002
53077
  }
53003
53078
  //Scripts
@@ -53221,8 +53296,26 @@ class ScriptWrapper extends InstanceWrapper {
53221
53296
  }
53222
53297
  }
53223
53298
  }
53299
+ async TrailTestRoAvatar(script) {
53300
+ await Wait(1);
53301
+ const part = script.parent;
53302
+ if (part) {
53303
+ const ogCF = part.Prop("CFrame").clone();
53304
+ while (true) {
53305
+ if (script.destroyed || this.data.shouldStop) return;
53306
+ const newCF = ogCF.clone();
53307
+ const val = Date.now() / 1e3 % 3 / 3 * 2 * Math.PI;
53308
+ const xAdd = Math.sin(val) * 2;
53309
+ const zAdd = Math.cos(val) * 2;
53310
+ newCF.Position[0] += xAdd;
53311
+ newCF.Position[2] += zAdd;
53312
+ part.setProperty("CFrame", newCF);
53313
+ await Wait(1 / 60);
53314
+ }
53315
+ }
53316
+ }
53224
53317
  }
53225
- const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53318
+ const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53226
53319
  __proto__: null,
53227
53320
  ScriptWrapper
53228
53321
  }, Symbol.toStringTag, { value: "Module" }));
@@ -53279,25 +53372,38 @@ class ToolWrapper extends InstanceWrapper {
53279
53372
  }
53280
53373
  }
53281
53374
  }
53282
- const __vite_glob_0_25 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53375
+ const __vite_glob_0_26 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53283
53376
  __proto__: null,
53284
53377
  ToolWrapper
53285
53378
  }, Symbol.toStringTag, { value: "Module" }));
53379
+ class UnionOperationWrapper extends BasePartWrapper {
53380
+ static className = "UnionOperation";
53381
+ static requiredProperties = [
53382
+ ...super.requiredProperties
53383
+ ];
53384
+ setup() {
53385
+ super.setup();
53386
+ }
53387
+ }
53388
+ const __vite_glob_0_27 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53389
+ __proto__: null,
53390
+ UnionOperationWrapper
53391
+ }, Symbol.toStringTag, { value: "Module" }));
53286
53392
  class WedgePartWrapper extends BasePartWrapper {
53287
53393
  static className = "WedgePart";
53288
53394
  }
53289
- const __vite_glob_0_26 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53395
+ const __vite_glob_0_28 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53290
53396
  __proto__: null,
53291
53397
  WedgePartWrapper
53292
53398
  }, Symbol.toStringTag, { value: "Module" }));
53293
53399
  class WeldWrapper extends JointInstanceWrapper {
53294
53400
  static className = "Weld";
53295
53401
  }
53296
- const __vite_glob_0_27 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53402
+ const __vite_glob_0_29 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53297
53403
  __proto__: null,
53298
53404
  WeldWrapper
53299
53405
  }, Symbol.toStringTag, { value: "Module" }));
53300
- const modules$1 = /* @__PURE__ */ Object.assign({ "./instance/Accessory.ts": __vite_glob_0_0$1, "./instance/AccessoryDescription.ts": __vite_glob_0_1$1, "./instance/AnimationConstraint.ts": __vite_glob_0_2$1, "./instance/Animator.ts": __vite_glob_0_3$1, "./instance/Attachment.ts": __vite_glob_0_4, "./instance/BasePart.ts": __vite_glob_0_5, "./instance/BodyColors.ts": __vite_glob_0_6, "./instance/BodyPartDescription.ts": __vite_glob_0_7, "./instance/Bone.ts": __vite_glob_0_8, "./instance/Camera.ts": __vite_glob_0_9, "./instance/Constraint.ts": __vite_glob_0_10, "./instance/Decal.ts": __vite_glob_0_11, "./instance/FaceControls.ts": __vite_glob_0_12, "./instance/HumanoidDescription.ts": __vite_glob_0_13, "./instance/InstanceWrapper.ts": __vite_glob_0_14, "./instance/JointInstance.ts": __vite_glob_0_15, "./instance/MakeupDescription.ts": __vite_glob_0_16, "./instance/ManualWeld.ts": __vite_glob_0_17, "./instance/MeshPart.ts": __vite_glob_0_18, "./instance/Model.ts": __vite_glob_0_19, "./instance/Motor6D.ts": __vite_glob_0_20, "./instance/Part.ts": __vite_glob_0_21, "./instance/ParticleEmitter.ts": __vite_glob_0_22, "./instance/Script.ts": __vite_glob_0_23, "./instance/Sound.ts": __vite_glob_0_24, "./instance/Tool.ts": __vite_glob_0_25, "./instance/WedgePart.ts": __vite_glob_0_26, "./instance/Weld.ts": __vite_glob_0_27 });
53406
+ const modules$1 = /* @__PURE__ */ Object.assign({ "./instance/Accessory.ts": __vite_glob_0_0$1, "./instance/AccessoryDescription.ts": __vite_glob_0_1$1, "./instance/AnimationConstraint.ts": __vite_glob_0_2$1, "./instance/Animator.ts": __vite_glob_0_3$1, "./instance/Attachment.ts": __vite_glob_0_4, "./instance/BasePart.ts": __vite_glob_0_5$1, "./instance/BodyColors.ts": __vite_glob_0_6, "./instance/BodyPartDescription.ts": __vite_glob_0_7, "./instance/Bone.ts": __vite_glob_0_8, "./instance/Camera.ts": __vite_glob_0_9, "./instance/Constraint.ts": __vite_glob_0_10, "./instance/Decal.ts": __vite_glob_0_11, "./instance/FaceControls.ts": __vite_glob_0_12, "./instance/HumanoidDescription.ts": __vite_glob_0_13, "./instance/InstanceWrapper.ts": __vite_glob_0_14, "./instance/JointInstance.ts": __vite_glob_0_15, "./instance/MakeupDescription.ts": __vite_glob_0_16, "./instance/ManualWeld.ts": __vite_glob_0_17, "./instance/MeshPart.ts": __vite_glob_0_18, "./instance/Model.ts": __vite_glob_0_19, "./instance/Motor.ts": __vite_glob_0_20, "./instance/Motor6D.ts": __vite_glob_0_21, "./instance/Part.ts": __vite_glob_0_22, "./instance/ParticleEmitter.ts": __vite_glob_0_23, "./instance/Script.ts": __vite_glob_0_24, "./instance/Sound.ts": __vite_glob_0_25, "./instance/Tool.ts": __vite_glob_0_26, "./instance/UnionOperation.ts": __vite_glob_0_27, "./instance/WedgePart.ts": __vite_glob_0_28, "./instance/Weld.ts": __vite_glob_0_29 });
53301
53407
  function RegisterWrappers() {
53302
53408
  for (const module of Object.values(modules$1)) {
53303
53409
  for (const exprt of Object.values(module)) {
@@ -53745,7 +53851,269 @@ const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
53745
53851
  __proto__: null,
53746
53852
  LightDesc
53747
53853
  }, Symbol.toStringTag, { value: "Module" }));
53748
- const modules = /* @__PURE__ */ Object.assign({ "./attachmentDesc.ts": __vite_glob_0_0, "./beamDesc.ts": __vite_glob_0_1, "./emitterGroupDesc.ts": __vite_glob_0_2, "./lightDesc.ts": __vite_glob_0_3, "./objectDesc.ts": __vite_glob_0_4$1 });
53854
+ class TrailSegment {
53855
+ cframe;
53856
+ length;
53857
+ time = 0;
53858
+ constructor(cf, length) {
53859
+ this.cframe = cf;
53860
+ this.length = length;
53861
+ }
53862
+ }
53863
+ class TrailDesc extends RenderDesc {
53864
+ static classTypes = ["Trail"];
53865
+ lastTime = Date.now() / 1e3;
53866
+ time = Date.now() / 1e3;
53867
+ segmentTime = 0;
53868
+ enabled = true;
53869
+ lightEmission = 0;
53870
+ //blends between normal -> additive blending, how?? graphics magic
53871
+ lightInfluence = 1;
53872
+ texture;
53873
+ textureLength = 1;
53874
+ textureMode = TextureMode.Stretch;
53875
+ color = ColorSequence.fromColor(new Color3(1, 1, 1));
53876
+ transparency = new NumberSequence([new NumberSequenceKeypoint(0, 0.5), new NumberSequenceKeypoint(1, 0.5)]);
53877
+ widthScale = new NumberSequence([new NumberSequenceKeypoint(0, 1), new NumberSequenceKeypoint(1, 1)]);
53878
+ cframe0 = new CFrame();
53879
+ cframe1 = new CFrame();
53880
+ lifetime = 1;
53881
+ maxLength = 0;
53882
+ minLength = 0.1;
53883
+ faceCamera = false;
53884
+ //results
53885
+ results = [];
53886
+ segments = [];
53887
+ get maxSegments() {
53888
+ const maxLength = this.maxLength === 0 ? 9999 : this.maxLength;
53889
+ return Math.ceil(Math.min(this.lifetime * FLAGS.TRAIL_FPS, maxLength / this.minLength)) + 2;
53890
+ }
53891
+ isSame(newDesc) {
53892
+ return this.time === newDesc.time && this.enabled === newDesc.enabled && this.lightEmission === newDesc.lightEmission && this.lightInfluence === newDesc.lightInfluence && this.texture === newDesc.texture && this.textureLength === newDesc.textureLength && this.textureMode === newDesc.textureMode && this.color.isSame(newDesc.color) && this.transparency.isSame(newDesc.transparency) && this.widthScale.isSame(newDesc.widthScale) && this.cframe0.isSame(newDesc.cframe0) && this.cframe1.isSame(newDesc.cframe1) && this.faceCamera === newDesc.faceCamera && this.lifetime === newDesc.lifetime && this.maxLength === newDesc.maxLength && this.minLength === newDesc.minLength;
53893
+ }
53894
+ needsRegeneration(newDesc) {
53895
+ return this.enabled !== newDesc.enabled || this.texture !== newDesc.texture || this.lifetime !== newDesc.lifetime;
53896
+ }
53897
+ virtualFromRenderDesc(newDesc) {
53898
+ this.time = newDesc.time;
53899
+ this.lightEmission = newDesc.lightEmission;
53900
+ this.lightInfluence = newDesc.lightInfluence;
53901
+ this.textureLength = newDesc.textureLength;
53902
+ this.textureMode = newDesc.textureMode;
53903
+ this.color = newDesc.color.clone();
53904
+ this.transparency = newDesc.transparency.clone();
53905
+ this.widthScale = newDesc.widthScale.clone();
53906
+ this.cframe0 = newDesc.cframe0.clone();
53907
+ this.cframe1 = newDesc.cframe1.clone();
53908
+ this.lifetime = newDesc.lifetime;
53909
+ this.maxLength = newDesc.maxLength;
53910
+ this.minLength = newDesc.minLength;
53911
+ this.faceCamera = newDesc.faceCamera;
53912
+ }
53913
+ virtualTransferFrom(oldDesc) {
53914
+ this.segmentTime = oldDesc.segmentTime;
53915
+ this.segments = oldDesc.segments;
53916
+ }
53917
+ fromInstance(child) {
53918
+ this.enabled = child.PropOrDefault("Enabled", this.enabled);
53919
+ this.lightEmission = child.PropOrDefault("LightEmission", this.lightEmission);
53920
+ this.lightInfluence = child.PropOrDefault("LightInfluence", this.lightInfluence);
53921
+ this.texture = child.PropOrDefault("Texture", this.texture);
53922
+ if (!this.texture) {
53923
+ const textureContent = child.PropOrDefault("TextureContent", void 0);
53924
+ if (textureContent) {
53925
+ this.texture = textureContent.uri;
53926
+ }
53927
+ }
53928
+ this.textureLength = child.PropOrDefault("TextureLength", this.textureLength);
53929
+ this.textureMode = child.PropOrDefault("TextureMode", this.textureMode);
53930
+ this.color = child.PropOrDefault("Color", this.color);
53931
+ this.transparency = child.PropOrDefault("Transparency", this.transparency);
53932
+ this.widthScale = child.PropOrDefault("WidthScale", this.widthScale);
53933
+ const att0 = child.PropOrDefault("Attachment0", void 0);
53934
+ if (att0 && att0.IsA("Attachment")) {
53935
+ const att0W = att0.w;
53936
+ this.cframe0 = att0W.getWorldCFrame();
53937
+ }
53938
+ const att1 = child.PropOrDefault("Attachment1", void 0);
53939
+ if (att1 && att1.IsA("Attachment")) {
53940
+ const att1W = att1.w;
53941
+ this.cframe1 = att1W.getWorldCFrame();
53942
+ }
53943
+ this.lifetime = child.PropOrDefault("Lifetime", this.lifetime);
53944
+ this.maxLength = child.PropOrDefault("MaxLength", this.maxLength);
53945
+ this.minLength = child.PropOrDefault("MinLength", this.minLength);
53946
+ this.faceCamera = child.PropOrDefault("FaceCamera", this.faceCamera);
53947
+ if (!FLAGS.BEAMS_ENABLED) this.enabled = false;
53948
+ }
53949
+ async compileResults(renderer, scene) {
53950
+ const originalResults = this.results;
53951
+ this.results = [];
53952
+ if (this.enabled) {
53953
+ let textureResult = void 0;
53954
+ if (this.texture) {
53955
+ textureResult = await getTexture(this.texture);
53956
+ if (textureResult) {
53957
+ textureResult.wrapT = RepeatWrapping;
53958
+ }
53959
+ }
53960
+ const material = new MeshBasicMaterial({
53961
+ side: DoubleSide,
53962
+ map: textureResult,
53963
+ vertexColors: true,
53964
+ transparent: true,
53965
+ depthWrite: false
53966
+ });
53967
+ const geometry = new PlaneGeometry(1, 1, this.maxSegments, 1);
53968
+ const colorValues = new Float32Array((this.maxSegments + 1) * 2 * 4).fill(1);
53969
+ geometry.setAttribute("color", new BufferAttribute(colorValues, 4));
53970
+ const mesh = new Mesh(geometry, material);
53971
+ mesh.frustumCulled = false;
53972
+ mesh.name = this.instance ? this.instance.PropOrDefault("Name", "Unknown") + "_Trail" : "Unknown_Trail";
53973
+ this.results.push(mesh);
53974
+ }
53975
+ if (originalResults) {
53976
+ this.disposeMeshes(scene, originalResults);
53977
+ this.disposeRenderLists(renderer);
53978
+ }
53979
+ this.updateResults();
53980
+ return this.results;
53981
+ }
53982
+ calculateSegmentCFrame() {
53983
+ let newCF = lerpCFrame(this.cframe0, this.cframe1, 0.5);
53984
+ newCF = CFrame.lookAt(newCF.Position, this.cframe0.Position);
53985
+ return newCF;
53986
+ }
53987
+ addSegment() {
53988
+ const newCF = this.calculateSegmentCFrame();
53989
+ const newLength = distance(this.cframe0.Position, this.cframe1.Position);
53990
+ const lastSegment = this.segments[0];
53991
+ if (lastSegment) {
53992
+ const lastSegmentDistance = distance(lastSegment.cframe.Position, newCF.Position);
53993
+ if (lastSegmentDistance <= this.minLength) {
53994
+ return;
53995
+ }
53996
+ }
53997
+ const newSegment = new TrailSegment(newCF, newLength);
53998
+ newSegment.time = this.segmentTime;
53999
+ this.segments.unshift(newSegment);
54000
+ }
54001
+ getSegmentCFrame(i) {
54002
+ if (i <= 0) {
54003
+ return this.calculateSegmentCFrame();
54004
+ } else {
54005
+ const segment = this.segments[specialClamp(i - 1, 0, this.segments.length - 1)];
54006
+ if (segment) {
54007
+ return segment.cframe;
54008
+ } else {
54009
+ return this.calculateSegmentCFrame();
54010
+ }
54011
+ }
54012
+ }
54013
+ getSegmentLength(i) {
54014
+ if (i <= 0) {
54015
+ return distance(this.cframe0.Position, this.cframe1.Position);
54016
+ } else {
54017
+ const segment = this.segments[specialClamp(i - 1, 0, this.segments.length - 1)];
54018
+ if (segment) {
54019
+ return segment.length;
54020
+ } else {
54021
+ return 0;
54022
+ }
54023
+ }
54024
+ }
54025
+ getSegmentTime(i) {
54026
+ if (i <= 0) {
54027
+ return this.segmentTime;
54028
+ } else {
54029
+ const segment = this.segments[specialClamp(i - 1, 0, this.segments.length - 1)];
54030
+ if (segment) {
54031
+ return segment.time;
54032
+ } else {
54033
+ return this.segmentTime;
54034
+ }
54035
+ }
54036
+ }
54037
+ updateResults() {
54038
+ if (!this.results) return;
54039
+ const deltaTime = this.time - this.lastTime;
54040
+ this.segmentTime += deltaTime;
54041
+ const requiredSegmentTime = 1 / FLAGS.TRAIL_FPS;
54042
+ for (const segment of this.segments) {
54043
+ segment.time += deltaTime;
54044
+ }
54045
+ let lastSegmentCF = void 0;
54046
+ for (let i = 0; i < this.segments.length; i++) {
54047
+ let totalLength = 0;
54048
+ const segment = this.segments[i];
54049
+ if (segment.time >= this.lifetime || totalLength > this.maxLength) {
54050
+ this.segments.splice(i, this.segments.length - i);
54051
+ break;
54052
+ }
54053
+ if (lastSegmentCF) {
54054
+ const diff = distance(lastSegmentCF.Position, segment.cframe.Position);
54055
+ totalLength += diff;
54056
+ }
54057
+ lastSegmentCF = segment.cframe;
54058
+ }
54059
+ if (this.segmentTime >= requiredSegmentTime) {
54060
+ this.addSegment();
54061
+ this.segmentTime = 0;
54062
+ }
54063
+ for (const result of this.results) {
54064
+ const resultMaterial = result.material;
54065
+ const resultGeometry = result.geometry;
54066
+ resultMaterial.blending = this.lightEmission > 0.5 ? AdditiveBlending : NormalBlending;
54067
+ const positions = resultGeometry.getAttribute("position");
54068
+ for (let i = 0; i < positions.count; i++) {
54069
+ const index = Math.floor(i % (positions.count / 2));
54070
+ const segmentLength = this.getSegmentLength(index);
54071
+ const segmentCF = this.getSegmentCFrame(index);
54072
+ const normSide = i < positions.count / 2 ? 0.5 : -0.5;
54073
+ const t = this.getSegmentTime(index) / this.lifetime;
54074
+ const side = normSide * segmentLength * this.widthScale.getValue(t, 0);
54075
+ const sideCF = segmentCF.multiply(new CFrame(0, 0, side));
54076
+ positions.setXYZ(i, ...sideCF.Position);
54077
+ }
54078
+ const colors = resultGeometry.getAttribute("color");
54079
+ for (let i = 0; i < colors.count; i++) {
54080
+ const index = Math.floor(i % (positions.count / 2));
54081
+ const t = this.getSegmentTime(index) / this.lifetime;
54082
+ const colorValue = this.color.getValue(t);
54083
+ const transparencyValue = this.transparency.getValue(t, 0);
54084
+ const mult = 1 + this.lightEmission;
54085
+ colors.setXYZW(i, colorValue.R * mult, colorValue.G * mult, colorValue.B * mult, 1 - transparencyValue);
54086
+ }
54087
+ const uvs = resultGeometry.getAttribute("uv");
54088
+ for (let i = 0; i < uvs.count; i++) {
54089
+ const index = Math.floor(i % (positions.count / 2));
54090
+ const t = index / this.segments.length;
54091
+ const normSide = i < positions.count / 2 ? 1 : 0;
54092
+ uvs.setXY(i, normSide, (1 - t) * this.textureLength);
54093
+ }
54094
+ positions.needsUpdate = true;
54095
+ colors.needsUpdate = true;
54096
+ uvs.needsUpdate = true;
54097
+ }
54098
+ this.lastTime = this.time;
54099
+ }
54100
+ moveLoose(vec) {
54101
+ for (const segment of this.segments) {
54102
+ segment.cframe.Position = add(segment.cframe.Position, vec);
54103
+ }
54104
+ }
54105
+ dispose(_renderer, scene) {
54106
+ if (!this.results) return;
54107
+ for (const result of this.results) {
54108
+ scene.remove(result);
54109
+ }
54110
+ }
54111
+ }
54112
+ const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
54113
+ __proto__: null,
54114
+ TrailDesc
54115
+ }, Symbol.toStringTag, { value: "Module" }));
54116
+ const modules = /* @__PURE__ */ Object.assign({ "./attachmentDesc.ts": __vite_glob_0_0, "./beamDesc.ts": __vite_glob_0_1, "./emitterGroupDesc.ts": __vite_glob_0_2, "./lightDesc.ts": __vite_glob_0_3, "./objectDesc.ts": __vite_glob_0_4$1, "./trailDesc.ts": __vite_glob_0_5 });
53749
54117
  function RegisterRenderDescs() {
53750
54118
  for (const module of Object.values(modules)) {
53751
54119
  for (const exprt of Object.values(module)) {
@@ -63403,6 +63771,10 @@ class OutfitRenderer {
63403
63771
  /**Does camera update every frame */
63404
63772
  doAddInstance = true;
63405
63773
  /**If outfitRenderer should call RBXRenderer.addInstance(), setting this to false will make OutfitRenderer return success early */
63774
+ doMoveLoose = true;
63775
+ /**If outfitRenderer should call this.moveLoose() when certain animations are playing */
63776
+ affectsLinearVelocity = true;
63777
+ /**If outfitRenderer should set the AssemblyLinearVelocity every animateOnce */
63406
63778
  forceAnimationLoop = true;
63407
63779
  /**If future loaded animations should be set to loop */
63408
63780
  backgroundRenderer;
@@ -63616,10 +63988,39 @@ class OutfitRenderer {
63616
63988
  this.animateOnce();
63617
63989
  }, 1e3 / this.animationFPS);
63618
63990
  }
63991
+ /**Animates moveLoose */
63992
+ animateMoveLoose(deltaTime) {
63993
+ if (!this.currentRig) return;
63994
+ const hrp = this.currentRig.FindFirstChild("HumanoidRootPart");
63995
+ if (hrp && hrp.IsA("BasePart")) {
63996
+ if (this.doMoveLoose) {
63997
+ const mainAnim = this.animatorW?.data.currentAnimation;
63998
+ let facing = hrp.Prop("CFrame").lookVector();
63999
+ facing[1] = 1e-3;
64000
+ facing = normalize(facing);
64001
+ let speed = 0;
64002
+ if (mainAnim === "run") speed = 16;
64003
+ else if (mainAnim === "walk") speed = 10;
64004
+ const diff = multiply(facing, [speed, speed, speed]);
64005
+ const deltaDiff = multiply(diff, [deltaTime, deltaTime, deltaTime]);
64006
+ const negDeltaDiff = minus([0, 0, 0], deltaDiff);
64007
+ this.moveLoose(negDeltaDiff);
64008
+ if (this.affectsLinearVelocity) {
64009
+ const hrpW = hrp.w;
64010
+ hrpW.GetAssembly().linearVelocity = new Vector3().fromVec3(diff);
64011
+ }
64012
+ } else {
64013
+ if (this.affectsLinearVelocity) {
64014
+ const hrpW = hrp.w;
64015
+ hrpW.GetAssembly().linearVelocity = new Vector3();
64016
+ }
64017
+ }
64018
+ }
64019
+ }
63619
64020
  /**
63620
64021
  * Updates the animation once
63621
64022
  */
63622
- animateOnce(deltaTimeOverride) {
64023
+ animateOnce(deltaTimeOverride, forceTime, forceKeyframe) {
63623
64024
  if (this.currentRig && this.auth) {
63624
64025
  const humanoid = this.currentRig.FindFirstChildOfClass("Humanoid");
63625
64026
  if (humanoid) {
@@ -63628,8 +64029,9 @@ class OutfitRenderer {
63628
64029
  const deltaTime = deltaTimeOverride !== void 0 ? deltaTimeOverride : (Date.now() / 1e3 - this.lastFrameTime) * this.deltaTimeMultiplier;
63629
64030
  this.lastFrameTime = Date.now() / 1e3;
63630
64031
  const animatorW = new AnimatorWrapper(animator);
63631
- animatorW.renderAnimation(deltaTime);
64032
+ animatorW.renderAnimation(deltaTime, forceTime, forceKeyframe);
63632
64033
  this.currentRig.preRender();
64034
+ this.animateMoveLoose(deltaTime);
63633
64035
  if (this.doAddInstance) RBXRenderer.addInstance(this.currentRig, this.auth, this.renderScene);
63634
64036
  }
63635
64037
  }
@@ -63679,7 +64081,8 @@ class OutfitRenderer {
63679
64081
  const animator = humanoid.FindFirstChildOfClass("Animator");
63680
64082
  if (animator) {
63681
64083
  const animatorW = new AnimatorWrapper(animator);
63682
- const successfullyPlayed = animatorW.playAnimation(name);
64084
+ let successfullyPlayed = animatorW.playAnimation(name);
64085
+ if (!successfullyPlayed && name === "pose") successfullyPlayed = animatorW.playAnimation("idle:0");
63683
64086
  if (!successfullyPlayed && name.startsWith("emote.") && name) {
63684
64087
  const emoteId = BigInt(name.split(".")[1]);
63685
64088
  animatorW.loadAvatarAnimation(emoteId, true, this.forceAnimationLoop).then(() => {
@@ -63794,6 +64197,19 @@ class OutfitRenderer {
63794
64197
  }
63795
64198
  }
63796
64199
  }
64200
+ /**
64201
+ * Moves "loose" things such as particles and trails by the Vec3 given, used to simulate character movement without actually moving the character
64202
+ */
64203
+ moveLoose(vec) {
64204
+ if (vec[0] === 0 && vec[1] === 0 && vec[2] === 0) return;
64205
+ if (!this.currentRig) return;
64206
+ for (const instance of this.currentRig.GetDescendants()) {
64207
+ const renderDesc = this.renderScene.renderDescs.get(instance);
64208
+ if (renderDesc) {
64209
+ renderDesc.moveLoose(vec);
64210
+ }
64211
+ }
64212
+ }
63797
64213
  /**Calls destroy on the rig, stops animating and disconnects connections. The OutfitRenderer should not be interacted with after this */
63798
64214
  destroy() {
63799
64215
  this.stopAnimating();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",