roavatar-renderer 1.8.1 → 1.9.0

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
@@ -431,6 +431,7 @@ export declare class Assembly {
431
431
  rootNode: AssemblyNode;
432
432
  allNodes: AssemblyNode[] | undefined;
433
433
  allConnectors: Instance[] | undefined;
434
+ linearVelocity: Vector3;
434
435
  constructor(rootPart: Instance);
435
436
  getNodeDescendants(): AssemblyNode[];
436
437
  getPartDescendants(): Instance[];
@@ -1655,6 +1656,8 @@ export declare const FLAGS: {
1655
1656
  * @deprecated This can now be set per-scene
1656
1657
  * */
1657
1658
  PARTICLES_START_FULL_FRAMERATE: number;
1659
+ /**amount of segments a trail can create per second */
1660
+ TRAIL_FPS: number;
1658
1661
  /**shows ThreeJS SkeletonHelper */
1659
1662
  SHOW_SKELETON_HELPER: boolean;
1660
1663
  /**if set the skeleton helper will only show if the instance has the name */
@@ -2732,7 +2735,16 @@ export declare class ModelWrapper extends InstanceWrapper {
2732
2735
  /**
2733
2736
  * @category InstanceWrapper
2734
2737
  */
2735
- export declare class Motor6DWrapper extends JointInstanceWrapper {
2738
+ export declare class Motor6DWrapper extends MotorWrapper {
2739
+ static className: string;
2740
+ static requiredProperties: string[];
2741
+ setup(): void;
2742
+ }
2743
+
2744
+ /**
2745
+ * @category InstanceWrapper
2746
+ */
2747
+ declare class MotorWrapper extends JointInstanceWrapper {
2736
2748
  static className: string;
2737
2749
  static requiredProperties: string[];
2738
2750
  setup(): void;
@@ -3103,6 +3115,8 @@ export declare class OutfitRenderer {
3103
3115
  doCameraUpdateOnLoad: boolean; /**Makes camera update when new avatar has loaded */
3104
3116
  doCameraUpdate: boolean; /**Does camera update every frame */
3105
3117
  doAddInstance: boolean; /**If outfitRenderer should call RBXRenderer.addInstance(), setting this to false will make OutfitRenderer return success early */
3118
+ doMoveLoose: boolean; /**If outfitRenderer should call this.moveLoose() when certain animations are playing */
3119
+ affectsLinearVelocity: boolean; /**If outfitRenderer should set the AssemblyLinearVelocity every animateOnce */
3106
3120
  forceAnimationLoop: boolean; /**If future loaded animations should be set to loop */
3107
3121
  backgroundRenderer: BackgroundRenderer;
3108
3122
  currentlyChangingRig: boolean;
@@ -3177,10 +3191,12 @@ export declare class OutfitRenderer {
3177
3191
  * Starts updating the animation of the outfit per frame
3178
3192
  */
3179
3193
  startAnimating(): void;
3194
+ /**Animates moveLoose */
3195
+ animateMoveLoose(deltaTime: number): void;
3180
3196
  /**
3181
3197
  * Updates the animation once
3182
3198
  */
3183
- animateOnce(deltaTimeOverride?: number): void;
3199
+ animateOnce(deltaTimeOverride?: number, forceTime?: number, forceKeyframe?: number): void;
3184
3200
  /**
3185
3201
  * Stops updating the animation of the outfit per frame
3186
3202
  */
@@ -3208,6 +3224,10 @@ export declare class OutfitRenderer {
3208
3224
  * Updates rendered particles so they face the camera without simulating them (usually used when generating thumbnails)
3209
3225
  */
3210
3226
  updateParticleMatrix(): void;
3227
+ /**
3228
+ * Moves "loose" things such as particles and trails by the Vec3 given, used to simulate character movement without actually moving the character
3229
+ */
3230
+ moveLoose(vec: Vec3): void;
3211
3231
  /**Calls destroy on the rig, stops animating and disconnects connections. The OutfitRenderer should not be interacted with after this */
3212
3232
  destroy(): void;
3213
3233
  }
@@ -3724,6 +3744,7 @@ declare class RenderDesc extends DisposableDesc {
3724
3744
  fromInstance(_child: Instance): void;
3725
3745
  compileResults(_renderer: THREE.WebGLRenderer, _scene: THREE.Scene): Promise<THREE.Object3D[] | Response | undefined>;
3726
3746
  updateResults(): void;
3747
+ moveLoose(_diff: Vec3): void;
3727
3748
  static shouldRenderInstance(_instance: Instance): boolean;
3728
3749
  static register(): void;
3729
3750
  static(): typeof RenderDesc;
@@ -3859,6 +3880,7 @@ export declare class ScriptWrapper extends InstanceWrapper {
3859
3880
  Run(): void;
3860
3881
  SoundPlayer(script: Instance): Promise<void>;
3861
3882
  HatScript20(script: Instance): Promise<void>;
3883
+ TrailTestRoAvatar(script: Instance): Promise<void>;
3862
3884
  }
3863
3885
 
3864
3886
  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;
@@ -44179,27 +44184,38 @@ class AccessoryWrapper extends InstanceWrapper {
44179
44184
  }
44180
44185
  }
44181
44186
  }
44182
- if (!bodyAttachment) {
44183
- return;
44184
- }
44185
- if (!accessoryAttachment) {
44186
- return;
44187
- }
44188
44187
  const oldAccessoryWeld = handle.FindFirstChild("AccessoryWeld");
44189
44188
  if (oldAccessoryWeld) {
44190
44189
  oldAccessoryWeld.Destroy();
44191
44190
  }
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);
44191
+ if (bodyAttachment && accessoryAttachment) {
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);
44203
+ } else {
44204
+ const head = this.instance.parent.FindFirstChild("Head");
44205
+ if (!head) return;
44206
+ const attachmentPoint = this.instance.PropOrDefault("AttachmentPoint", new CFrame());
44207
+ const weld = new Instance("Weld");
44208
+ weld.addProperty(new Property("Name", DataType.String), "AccessoryWeld");
44209
+ weld.addProperty(new Property("Archivable", DataType.Bool), true);
44210
+ weld.addProperty(new Property("C1", DataType.CFrame), attachmentPoint.clone());
44211
+ weld.addProperty(new Property("C0", DataType.CFrame), new CFrame());
44212
+ weld.addProperty(new Property("Part1", DataType.Referent), handle);
44213
+ weld.addProperty(new Property("Part0", DataType.Referent), head);
44214
+ weld.addProperty(new Property("Active", DataType.Bool), true);
44215
+ weld.addProperty(new Property("Enabled", DataType.Bool), false);
44216
+ weld.setParent(handle);
44217
+ weld.setProperty("Enabled", true);
44218
+ }
44203
44219
  }
44204
44220
  }
44205
44221
  }
@@ -48094,7 +48110,7 @@ class BasePartWrapper extends InstanceWrapper {
48094
48110
  return connected;
48095
48111
  }
48096
48112
  }
48097
- const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48113
+ const __vite_glob_0_5$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48098
48114
  __proto__: null,
48099
48115
  BasePartWrapper
48100
48116
  }, Symbol.toStringTag, { value: "Module" }));
@@ -51922,7 +51938,20 @@ const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
51922
51938
  __proto__: null,
51923
51939
  ModelWrapper
51924
51940
  }, Symbol.toStringTag, { value: "Module" }));
51925
- class Motor6DWrapper extends JointInstanceWrapper {
51941
+ class MotorWrapper extends JointInstanceWrapper {
51942
+ static className = "Motor";
51943
+ static requiredProperties = [
51944
+ ...super.requiredProperties
51945
+ ];
51946
+ setup() {
51947
+ super.setup();
51948
+ }
51949
+ }
51950
+ const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51951
+ __proto__: null,
51952
+ MotorWrapper
51953
+ }, Symbol.toStringTag, { value: "Module" }));
51954
+ class Motor6DWrapper extends MotorWrapper {
51926
51955
  static className = "Motor6D";
51927
51956
  static requiredProperties = [
51928
51957
  ...super.requiredProperties,
@@ -51933,7 +51962,7 @@ class Motor6DWrapper extends JointInstanceWrapper {
51933
51962
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
51934
51963
  }
51935
51964
  }
51936
- const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51965
+ const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51937
51966
  __proto__: null,
51938
51967
  Motor6DWrapper
51939
51968
  }, Symbol.toStringTag, { value: "Module" }));
@@ -51948,7 +51977,7 @@ class PartWrapper extends BasePartWrapper {
51948
51977
  if (!this.instance.HasProperty("shape")) this.instance.addProperty(new Property("shape", DataType.Enum), PartType.Block);
51949
51978
  }
51950
51979
  }
51951
- const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51980
+ const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51952
51981
  __proto__: null,
51953
51982
  PartWrapper
51954
51983
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52417,7 +52446,7 @@ class EmitterDesc extends DisposableDesc {
52417
52446
  const velocityOriginal = new Vector3$1(...velocityFront.toVec3()).multiply(velocityMultiplier);
52418
52447
  const velocityLocal = velocityOriginal.applyQuaternion(groupDesc.getNormalQuaternionForVelocity());
52419
52448
  const worldVelocity = velocityLocal.applyQuaternion(new Quaternion().setFromRotationMatrix(groupDesc.cframe.getTHREEMatrix()));
52420
- const worldVelocityRoblox = new Vector3(...worldVelocity.toArray());
52449
+ const worldVelocityRoblox = new Vector3(...worldVelocity.toArray()).add(groupDesc.parentVelocity);
52421
52450
  let localPos = groupDesc.getRandomLocalPos();
52422
52451
  localPos = localPos.add(this.offset);
52423
52452
  const worldPos = groupDesc.toWorldSpace(localPos);
@@ -52527,6 +52556,7 @@ class EmitterGroupDesc extends RenderDesc {
52527
52556
  lastCframe = new CFrame();
52528
52557
  cframe = new CFrame();
52529
52558
  emitterDir = NormalId.Top;
52559
+ parentVelocity = new Vector3();
52530
52560
  emitterDescs = [];
52531
52561
  //special for emitter group
52532
52562
  getRandomLocalPos() {
@@ -52626,6 +52656,15 @@ class EmitterGroupDesc extends RenderDesc {
52626
52656
  this.higherBound = size.multiply(new Vector3(0.5, 0.5, 0.5));
52627
52657
  this.lowerBound = size.multiply(new Vector3(-0.5, -0.5, -0.5));
52628
52658
  }
52659
+ let lastParent = parent;
52660
+ while (lastParent) {
52661
+ if (lastParent.IsA("BasePart")) {
52662
+ const assembly = lastParent.w.GetAssembly();
52663
+ this.parentVelocity = assembly.linearVelocity.clone();
52664
+ break;
52665
+ }
52666
+ lastParent = lastParent.parent;
52667
+ }
52629
52668
  }
52630
52669
  this.enabled = child.PropOrDefault("Enabled", true);
52631
52670
  const className = child.className;
@@ -52836,6 +52875,14 @@ class EmitterGroupDesc extends RenderDesc {
52836
52875
  }
52837
52876
  this.lastCframe = this.cframe.clone();
52838
52877
  }
52878
+ moveLoose(vec) {
52879
+ for (const emitterDesc of this.emitterDescs) {
52880
+ if (emitterDesc.lockedToPart) continue;
52881
+ for (const particle of emitterDesc.particles) {
52882
+ particle.position = particle.position.add(new Vector3().fromVec3(vec));
52883
+ }
52884
+ }
52885
+ }
52839
52886
  }
52840
52887
  const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52841
52888
  __proto__: null,
@@ -52862,7 +52909,7 @@ class ParticleEmitterWrapper extends InstanceWrapper {
52862
52909
  }
52863
52910
  }
52864
52911
  }
52865
- const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52912
+ const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52866
52913
  __proto__: null,
52867
52914
  ParticleEmitterWrapper
52868
52915
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52968,7 +53015,7 @@ class SoundWrapper extends InstanceWrapper {
52968
53015
  }
52969
53016
  }
52970
53017
  }
52971
- const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53018
+ const __vite_glob_0_25 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52972
53019
  __proto__: null,
52973
53020
  SoundWrapper
52974
53021
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52998,6 +53045,9 @@ class ScriptWrapper extends InstanceWrapper {
52998
53045
  case "HatScript2.0":
52999
53046
  this.HatScript20(this.instance);
53000
53047
  break;
53048
+ case "TrailTestRoAvatar":
53049
+ this.TrailTestRoAvatar(this.instance);
53050
+ break;
53001
53051
  }
53002
53052
  }
53003
53053
  //Scripts
@@ -53221,8 +53271,26 @@ class ScriptWrapper extends InstanceWrapper {
53221
53271
  }
53222
53272
  }
53223
53273
  }
53274
+ async TrailTestRoAvatar(script) {
53275
+ await Wait(1);
53276
+ const part = script.parent;
53277
+ if (part) {
53278
+ const ogCF = part.Prop("CFrame").clone();
53279
+ while (true) {
53280
+ if (script.destroyed || this.data.shouldStop) return;
53281
+ const newCF = ogCF.clone();
53282
+ const val = Date.now() / 1e3 % 3 / 3 * 2 * Math.PI;
53283
+ const xAdd = Math.sin(val) * 2;
53284
+ const zAdd = Math.cos(val) * 2;
53285
+ newCF.Position[0] += xAdd;
53286
+ newCF.Position[2] += zAdd;
53287
+ part.setProperty("CFrame", newCF);
53288
+ await Wait(1 / 60);
53289
+ }
53290
+ }
53291
+ }
53224
53292
  }
53225
- const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53293
+ const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53226
53294
  __proto__: null,
53227
53295
  ScriptWrapper
53228
53296
  }, Symbol.toStringTag, { value: "Module" }));
@@ -53279,25 +53347,38 @@ class ToolWrapper extends InstanceWrapper {
53279
53347
  }
53280
53348
  }
53281
53349
  }
53282
- const __vite_glob_0_25 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53350
+ const __vite_glob_0_26 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53283
53351
  __proto__: null,
53284
53352
  ToolWrapper
53285
53353
  }, Symbol.toStringTag, { value: "Module" }));
53354
+ class UnionOperationWrapper extends BasePartWrapper {
53355
+ static className = "UnionOperation";
53356
+ static requiredProperties = [
53357
+ ...super.requiredProperties
53358
+ ];
53359
+ setup() {
53360
+ super.setup();
53361
+ }
53362
+ }
53363
+ const __vite_glob_0_27 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53364
+ __proto__: null,
53365
+ UnionOperationWrapper
53366
+ }, Symbol.toStringTag, { value: "Module" }));
53286
53367
  class WedgePartWrapper extends BasePartWrapper {
53287
53368
  static className = "WedgePart";
53288
53369
  }
53289
- const __vite_glob_0_26 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53370
+ const __vite_glob_0_28 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53290
53371
  __proto__: null,
53291
53372
  WedgePartWrapper
53292
53373
  }, Symbol.toStringTag, { value: "Module" }));
53293
53374
  class WeldWrapper extends JointInstanceWrapper {
53294
53375
  static className = "Weld";
53295
53376
  }
53296
- const __vite_glob_0_27 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53377
+ const __vite_glob_0_29 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53297
53378
  __proto__: null,
53298
53379
  WeldWrapper
53299
53380
  }, 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 });
53381
+ 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
53382
  function RegisterWrappers() {
53302
53383
  for (const module of Object.values(modules$1)) {
53303
53384
  for (const exprt of Object.values(module)) {
@@ -53745,7 +53826,269 @@ const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
53745
53826
  __proto__: null,
53746
53827
  LightDesc
53747
53828
  }, 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 });
53829
+ class TrailSegment {
53830
+ cframe;
53831
+ length;
53832
+ time = 0;
53833
+ constructor(cf, length) {
53834
+ this.cframe = cf;
53835
+ this.length = length;
53836
+ }
53837
+ }
53838
+ class TrailDesc extends RenderDesc {
53839
+ static classTypes = ["Trail"];
53840
+ lastTime = Date.now() / 1e3;
53841
+ time = Date.now() / 1e3;
53842
+ segmentTime = 0;
53843
+ enabled = true;
53844
+ lightEmission = 0;
53845
+ //blends between normal -> additive blending, how?? graphics magic
53846
+ lightInfluence = 1;
53847
+ texture;
53848
+ textureLength = 1;
53849
+ textureMode = TextureMode.Stretch;
53850
+ color = ColorSequence.fromColor(new Color3(1, 1, 1));
53851
+ transparency = new NumberSequence([new NumberSequenceKeypoint(0, 0.5), new NumberSequenceKeypoint(1, 0.5)]);
53852
+ widthScale = new NumberSequence([new NumberSequenceKeypoint(0, 1), new NumberSequenceKeypoint(1, 1)]);
53853
+ cframe0 = new CFrame();
53854
+ cframe1 = new CFrame();
53855
+ lifetime = 1;
53856
+ maxLength = 0;
53857
+ minLength = 0.1;
53858
+ faceCamera = false;
53859
+ //results
53860
+ results = [];
53861
+ segments = [];
53862
+ get maxSegments() {
53863
+ const maxLength = this.maxLength === 0 ? 9999 : this.maxLength;
53864
+ return Math.ceil(Math.min(this.lifetime * FLAGS.TRAIL_FPS, maxLength / this.minLength)) + 2;
53865
+ }
53866
+ isSame(newDesc) {
53867
+ 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;
53868
+ }
53869
+ needsRegeneration(newDesc) {
53870
+ return this.enabled !== newDesc.enabled || this.texture !== newDesc.texture || this.lifetime !== newDesc.lifetime;
53871
+ }
53872
+ virtualFromRenderDesc(newDesc) {
53873
+ this.time = newDesc.time;
53874
+ this.lightEmission = newDesc.lightEmission;
53875
+ this.lightInfluence = newDesc.lightInfluence;
53876
+ this.textureLength = newDesc.textureLength;
53877
+ this.textureMode = newDesc.textureMode;
53878
+ this.color = newDesc.color.clone();
53879
+ this.transparency = newDesc.transparency.clone();
53880
+ this.widthScale = newDesc.widthScale.clone();
53881
+ this.cframe0 = newDesc.cframe0.clone();
53882
+ this.cframe1 = newDesc.cframe1.clone();
53883
+ this.lifetime = newDesc.lifetime;
53884
+ this.maxLength = newDesc.maxLength;
53885
+ this.minLength = newDesc.minLength;
53886
+ this.faceCamera = newDesc.faceCamera;
53887
+ }
53888
+ virtualTransferFrom(oldDesc) {
53889
+ this.segmentTime = oldDesc.segmentTime;
53890
+ this.segments = oldDesc.segments;
53891
+ }
53892
+ fromInstance(child) {
53893
+ this.enabled = child.PropOrDefault("Enabled", this.enabled);
53894
+ this.lightEmission = child.PropOrDefault("LightEmission", this.lightEmission);
53895
+ this.lightInfluence = child.PropOrDefault("LightInfluence", this.lightInfluence);
53896
+ this.texture = child.PropOrDefault("Texture", this.texture);
53897
+ if (!this.texture) {
53898
+ const textureContent = child.PropOrDefault("TextureContent", void 0);
53899
+ if (textureContent) {
53900
+ this.texture = textureContent.uri;
53901
+ }
53902
+ }
53903
+ this.textureLength = child.PropOrDefault("TextureLength", this.textureLength);
53904
+ this.textureMode = child.PropOrDefault("TextureMode", this.textureMode);
53905
+ this.color = child.PropOrDefault("Color", this.color);
53906
+ this.transparency = child.PropOrDefault("Transparency", this.transparency);
53907
+ this.widthScale = child.PropOrDefault("WidthScale", this.widthScale);
53908
+ const att0 = child.PropOrDefault("Attachment0", void 0);
53909
+ if (att0 && att0.IsA("Attachment")) {
53910
+ const att0W = att0.w;
53911
+ this.cframe0 = att0W.getWorldCFrame();
53912
+ }
53913
+ const att1 = child.PropOrDefault("Attachment1", void 0);
53914
+ if (att1 && att1.IsA("Attachment")) {
53915
+ const att1W = att1.w;
53916
+ this.cframe1 = att1W.getWorldCFrame();
53917
+ }
53918
+ this.lifetime = child.PropOrDefault("Lifetime", this.lifetime);
53919
+ this.maxLength = child.PropOrDefault("MaxLength", this.maxLength);
53920
+ this.minLength = child.PropOrDefault("MinLength", this.minLength);
53921
+ this.faceCamera = child.PropOrDefault("FaceCamera", this.faceCamera);
53922
+ if (!FLAGS.BEAMS_ENABLED) this.enabled = false;
53923
+ }
53924
+ async compileResults(renderer, scene) {
53925
+ const originalResults = this.results;
53926
+ this.results = [];
53927
+ if (this.enabled) {
53928
+ let textureResult = void 0;
53929
+ if (this.texture) {
53930
+ textureResult = await getTexture(this.texture);
53931
+ if (textureResult) {
53932
+ textureResult.wrapT = RepeatWrapping;
53933
+ }
53934
+ }
53935
+ const material = new MeshBasicMaterial({
53936
+ side: DoubleSide,
53937
+ map: textureResult,
53938
+ vertexColors: true,
53939
+ transparent: true,
53940
+ depthWrite: false
53941
+ });
53942
+ const geometry = new PlaneGeometry(1, 1, this.maxSegments, 1);
53943
+ const colorValues = new Float32Array((this.maxSegments + 1) * 2 * 4).fill(1);
53944
+ geometry.setAttribute("color", new BufferAttribute(colorValues, 4));
53945
+ const mesh = new Mesh(geometry, material);
53946
+ mesh.frustumCulled = false;
53947
+ mesh.name = this.instance ? this.instance.PropOrDefault("Name", "Unknown") + "_Trail" : "Unknown_Trail";
53948
+ this.results.push(mesh);
53949
+ }
53950
+ if (originalResults) {
53951
+ this.disposeMeshes(scene, originalResults);
53952
+ this.disposeRenderLists(renderer);
53953
+ }
53954
+ this.updateResults();
53955
+ return this.results;
53956
+ }
53957
+ calculateSegmentCFrame() {
53958
+ let newCF = lerpCFrame(this.cframe0, this.cframe1, 0.5);
53959
+ newCF = CFrame.lookAt(newCF.Position, this.cframe0.Position);
53960
+ return newCF;
53961
+ }
53962
+ addSegment() {
53963
+ const newCF = this.calculateSegmentCFrame();
53964
+ const newLength = distance(this.cframe0.Position, this.cframe1.Position);
53965
+ const lastSegment = this.segments[0];
53966
+ if (lastSegment) {
53967
+ const lastSegmentDistance = distance(lastSegment.cframe.Position, newCF.Position);
53968
+ if (lastSegmentDistance <= this.minLength) {
53969
+ return;
53970
+ }
53971
+ }
53972
+ const newSegment = new TrailSegment(newCF, newLength);
53973
+ newSegment.time = this.segmentTime;
53974
+ this.segments.unshift(newSegment);
53975
+ }
53976
+ getSegmentCFrame(i) {
53977
+ if (i <= 0) {
53978
+ return this.calculateSegmentCFrame();
53979
+ } else {
53980
+ const segment = this.segments[specialClamp(i - 1, 0, this.segments.length - 1)];
53981
+ if (segment) {
53982
+ return segment.cframe;
53983
+ } else {
53984
+ return this.calculateSegmentCFrame();
53985
+ }
53986
+ }
53987
+ }
53988
+ getSegmentLength(i) {
53989
+ if (i <= 0) {
53990
+ return distance(this.cframe0.Position, this.cframe1.Position);
53991
+ } else {
53992
+ const segment = this.segments[specialClamp(i - 1, 0, this.segments.length - 1)];
53993
+ if (segment) {
53994
+ return segment.length;
53995
+ } else {
53996
+ return 0;
53997
+ }
53998
+ }
53999
+ }
54000
+ getSegmentTime(i) {
54001
+ if (i <= 0) {
54002
+ return this.segmentTime;
54003
+ } else {
54004
+ const segment = this.segments[specialClamp(i - 1, 0, this.segments.length - 1)];
54005
+ if (segment) {
54006
+ return segment.time;
54007
+ } else {
54008
+ return this.segmentTime;
54009
+ }
54010
+ }
54011
+ }
54012
+ updateResults() {
54013
+ if (!this.results) return;
54014
+ const deltaTime = this.time - this.lastTime;
54015
+ this.segmentTime += deltaTime;
54016
+ const requiredSegmentTime = 1 / FLAGS.TRAIL_FPS;
54017
+ for (const segment of this.segments) {
54018
+ segment.time += deltaTime;
54019
+ }
54020
+ let lastSegmentCF = void 0;
54021
+ for (let i = 0; i < this.segments.length; i++) {
54022
+ let totalLength = 0;
54023
+ const segment = this.segments[i];
54024
+ if (segment.time >= this.lifetime || totalLength > this.maxLength) {
54025
+ this.segments.splice(i, this.segments.length - i);
54026
+ break;
54027
+ }
54028
+ if (lastSegmentCF) {
54029
+ const diff = distance(lastSegmentCF.Position, segment.cframe.Position);
54030
+ totalLength += diff;
54031
+ }
54032
+ lastSegmentCF = segment.cframe;
54033
+ }
54034
+ if (this.segmentTime >= requiredSegmentTime) {
54035
+ this.addSegment();
54036
+ this.segmentTime = 0;
54037
+ }
54038
+ for (const result of this.results) {
54039
+ const resultMaterial = result.material;
54040
+ const resultGeometry = result.geometry;
54041
+ resultMaterial.blending = this.lightEmission > 0.5 ? AdditiveBlending : NormalBlending;
54042
+ const positions = resultGeometry.getAttribute("position");
54043
+ for (let i = 0; i < positions.count; i++) {
54044
+ const index = Math.floor(i % (positions.count / 2));
54045
+ const segmentLength = this.getSegmentLength(index);
54046
+ const segmentCF = this.getSegmentCFrame(index);
54047
+ const normSide = i < positions.count / 2 ? 0.5 : -0.5;
54048
+ const t = this.getSegmentTime(index) / this.lifetime;
54049
+ const side = normSide * segmentLength * this.widthScale.getValue(t, 0);
54050
+ const sideCF = segmentCF.multiply(new CFrame(0, 0, side));
54051
+ positions.setXYZ(i, ...sideCF.Position);
54052
+ }
54053
+ const colors = resultGeometry.getAttribute("color");
54054
+ for (let i = 0; i < colors.count; i++) {
54055
+ const index = Math.floor(i % (positions.count / 2));
54056
+ const t = this.getSegmentTime(index) / this.lifetime;
54057
+ const colorValue = this.color.getValue(t);
54058
+ const transparencyValue = this.transparency.getValue(t, 0);
54059
+ const mult = 1 + this.lightEmission;
54060
+ colors.setXYZW(i, colorValue.R * mult, colorValue.G * mult, colorValue.B * mult, 1 - transparencyValue);
54061
+ }
54062
+ const uvs = resultGeometry.getAttribute("uv");
54063
+ for (let i = 0; i < uvs.count; i++) {
54064
+ const index = Math.floor(i % (positions.count / 2));
54065
+ const t = index / this.segments.length;
54066
+ const normSide = i < positions.count / 2 ? 1 : 0;
54067
+ uvs.setXY(i, normSide, (1 - t) * this.textureLength);
54068
+ }
54069
+ positions.needsUpdate = true;
54070
+ colors.needsUpdate = true;
54071
+ uvs.needsUpdate = true;
54072
+ }
54073
+ this.lastTime = this.time;
54074
+ }
54075
+ moveLoose(vec) {
54076
+ for (const segment of this.segments) {
54077
+ segment.cframe.Position = add(segment.cframe.Position, vec);
54078
+ }
54079
+ }
54080
+ dispose(_renderer, scene) {
54081
+ if (!this.results) return;
54082
+ for (const result of this.results) {
54083
+ scene.remove(result);
54084
+ }
54085
+ }
54086
+ }
54087
+ const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
54088
+ __proto__: null,
54089
+ TrailDesc
54090
+ }, Symbol.toStringTag, { value: "Module" }));
54091
+ 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
54092
  function RegisterRenderDescs() {
53750
54093
  for (const module of Object.values(modules)) {
53751
54094
  for (const exprt of Object.values(module)) {
@@ -63403,6 +63746,10 @@ class OutfitRenderer {
63403
63746
  /**Does camera update every frame */
63404
63747
  doAddInstance = true;
63405
63748
  /**If outfitRenderer should call RBXRenderer.addInstance(), setting this to false will make OutfitRenderer return success early */
63749
+ doMoveLoose = true;
63750
+ /**If outfitRenderer should call this.moveLoose() when certain animations are playing */
63751
+ affectsLinearVelocity = true;
63752
+ /**If outfitRenderer should set the AssemblyLinearVelocity every animateOnce */
63406
63753
  forceAnimationLoop = true;
63407
63754
  /**If future loaded animations should be set to loop */
63408
63755
  backgroundRenderer;
@@ -63616,10 +63963,39 @@ class OutfitRenderer {
63616
63963
  this.animateOnce();
63617
63964
  }, 1e3 / this.animationFPS);
63618
63965
  }
63966
+ /**Animates moveLoose */
63967
+ animateMoveLoose(deltaTime) {
63968
+ if (!this.currentRig) return;
63969
+ const hrp = this.currentRig.FindFirstChild("HumanoidRootPart");
63970
+ if (hrp && hrp.IsA("BasePart")) {
63971
+ if (this.doMoveLoose) {
63972
+ const mainAnim = this.animatorW?.data.currentAnimation;
63973
+ let facing = hrp.Prop("CFrame").lookVector();
63974
+ facing[1] = 1e-3;
63975
+ facing = normalize(facing);
63976
+ let speed = 0;
63977
+ if (mainAnim === "run") speed = 16;
63978
+ else if (mainAnim === "walk") speed = 10;
63979
+ const diff = multiply(facing, [speed, speed, speed]);
63980
+ const deltaDiff = multiply(diff, [deltaTime, deltaTime, deltaTime]);
63981
+ const negDeltaDiff = minus([0, 0, 0], deltaDiff);
63982
+ this.moveLoose(negDeltaDiff);
63983
+ if (this.affectsLinearVelocity) {
63984
+ const hrpW = hrp.w;
63985
+ hrpW.GetAssembly().linearVelocity = new Vector3().fromVec3(diff);
63986
+ }
63987
+ } else {
63988
+ if (this.affectsLinearVelocity) {
63989
+ const hrpW = hrp.w;
63990
+ hrpW.GetAssembly().linearVelocity = new Vector3();
63991
+ }
63992
+ }
63993
+ }
63994
+ }
63619
63995
  /**
63620
63996
  * Updates the animation once
63621
63997
  */
63622
- animateOnce(deltaTimeOverride) {
63998
+ animateOnce(deltaTimeOverride, forceTime, forceKeyframe) {
63623
63999
  if (this.currentRig && this.auth) {
63624
64000
  const humanoid = this.currentRig.FindFirstChildOfClass("Humanoid");
63625
64001
  if (humanoid) {
@@ -63628,8 +64004,9 @@ class OutfitRenderer {
63628
64004
  const deltaTime = deltaTimeOverride !== void 0 ? deltaTimeOverride : (Date.now() / 1e3 - this.lastFrameTime) * this.deltaTimeMultiplier;
63629
64005
  this.lastFrameTime = Date.now() / 1e3;
63630
64006
  const animatorW = new AnimatorWrapper(animator);
63631
- animatorW.renderAnimation(deltaTime);
64007
+ animatorW.renderAnimation(deltaTime, forceTime, forceKeyframe);
63632
64008
  this.currentRig.preRender();
64009
+ this.animateMoveLoose(deltaTime);
63633
64010
  if (this.doAddInstance) RBXRenderer.addInstance(this.currentRig, this.auth, this.renderScene);
63634
64011
  }
63635
64012
  }
@@ -63679,7 +64056,8 @@ class OutfitRenderer {
63679
64056
  const animator = humanoid.FindFirstChildOfClass("Animator");
63680
64057
  if (animator) {
63681
64058
  const animatorW = new AnimatorWrapper(animator);
63682
- const successfullyPlayed = animatorW.playAnimation(name);
64059
+ let successfullyPlayed = animatorW.playAnimation(name);
64060
+ if (!successfullyPlayed && name === "pose") successfullyPlayed = animatorW.playAnimation("idle:0");
63683
64061
  if (!successfullyPlayed && name.startsWith("emote.") && name) {
63684
64062
  const emoteId = BigInt(name.split(".")[1]);
63685
64063
  animatorW.loadAvatarAnimation(emoteId, true, this.forceAnimationLoop).then(() => {
@@ -63794,6 +64172,19 @@ class OutfitRenderer {
63794
64172
  }
63795
64173
  }
63796
64174
  }
64175
+ /**
64176
+ * Moves "loose" things such as particles and trails by the Vec3 given, used to simulate character movement without actually moving the character
64177
+ */
64178
+ moveLoose(vec) {
64179
+ if (vec[0] === 0 && vec[1] === 0 && vec[2] === 0) return;
64180
+ if (!this.currentRig) return;
64181
+ for (const instance of this.currentRig.GetDescendants()) {
64182
+ const renderDesc = this.renderScene.renderDescs.get(instance);
64183
+ if (renderDesc) {
64184
+ renderDesc.moveLoose(vec);
64185
+ }
64186
+ }
64187
+ }
63797
64188
  /**Calls destroy on the rig, stops animating and disconnects connections. The OutfitRenderer should not be interacted with after this */
63798
64189
  destroy() {
63799
64190
  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.0",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",