diff --git a/unpublishedScripts/marketplace/doppleganger-attachments/dist/app-doppleganger-marketplace.js b/unpublishedScripts/marketplace/doppleganger-attachments/dist/app-doppleganger-marketplace.js
index c2cf2a2353..bc5368ba5b 100644
--- a/unpublishedScripts/marketplace/doppleganger-attachments/dist/app-doppleganger-marketplace.js
+++ b/unpublishedScripts/marketplace/doppleganger-attachments/dist/app-doppleganger-marketplace.js
@@ -599,6 +599,20 @@ Doppleganger.prototype = {
return this.active;
},
+ // @private @method - get an avatar's "absolute joint translations in object frame" as local translations
+ // @param {AvatarData} - avatar to read translations from
+ // @return {glm::vec3[]} - the adapted translations
+ _getLocalAvatarJointTranslations: function(avatar) {
+ // NOTE: avatar.getJointTranslations() seems to return meters and avatar.getJointTranslation(jointIndex) centimeters...
+ // adapting meters -> centimeters on this side seems to fix the "scrunching into ball" problem (~Beta 54)
+ // and perform slightly faster than calling getJointTranslation(jointIndex) N times.
+ const CENTIMETERS_PER_METER = 100.0;
+ function scaleToMeters(v) {
+ return Vec3.multiply(CENTIMETERS_PER_METER, v);
+ }
+ return avatar.getJointTranslations().map(scaleToMeters);
+ },
+
// @public @method - synchronize the joint data between Avatar / doppleganger
update: function() {
this.frame++;
@@ -612,7 +626,7 @@ Doppleganger.prototype = {
}
var rotations = this.avatar.getJointRotations();
- var translations = this.avatar.getJointTranslations();
+ var translations = this._getLocalAvatarJointTranslations(this.avatar);
var size = rotations.length;
// note: this mismatch can happen when the avatar's model is actively changing
@@ -1488,13 +1502,13 @@ DebugControls.prototype = {
/* 6 */
/***/ (function(module, exports) {
-module.exports = "data:image/svg+xml;xml,\n\n\n";
+module.exports = "data:image/svg+xml;xml,\n\n\n"
/***/ }),
/* 7 */
/***/ (function(module, exports) {
-module.exports = "data:image/svg+xml;xml,\n\n\n";
+module.exports = "data:image/svg+xml;xml,\n\n\n"
/***/ })
/******/ ]);
\ No newline at end of file
diff --git a/unpublishedScripts/marketplace/doppleganger-attachments/doppleganger.js b/unpublishedScripts/marketplace/doppleganger-attachments/doppleganger.js
index 190a8aa69e..9e35d791d6 100644
--- a/unpublishedScripts/marketplace/doppleganger-attachments/doppleganger.js
+++ b/unpublishedScripts/marketplace/doppleganger-attachments/doppleganger.js
@@ -78,6 +78,20 @@ Doppleganger.prototype = {
return this.active;
},
+ // @private @method - get an avatar's "absolute joint translations in object frame" as local translations
+ // @param {AvatarData} - avatar to read translations from
+ // @return {glm::vec3[]} - the adapted translations
+ _getLocalAvatarJointTranslations: function(avatar) {
+ // NOTE: avatar.getJointTranslations() seems to return meters and avatar.getJointTranslation(jointIndex) centimeters...
+ // adapting meters -> centimeters on this side seems to fix the "scrunching into ball" problem (~Beta 54)
+ // and perform slightly faster than calling getJointTranslation(jointIndex) N times.
+ const CENTIMETERS_PER_METER = 100.0;
+ function scaleToMeters(v) {
+ return Vec3.multiply(CENTIMETERS_PER_METER, v);
+ }
+ return avatar.getJointTranslations().map(scaleToMeters);
+ },
+
// @public @method - synchronize the joint data between Avatar / doppleganger
update: function() {
this.frame++;
@@ -91,7 +105,7 @@ Doppleganger.prototype = {
}
var rotations = this.avatar.getJointRotations();
- var translations = this.avatar.getJointTranslations();
+ var translations = this._getLocalAvatarJointTranslations(this.avatar);
var size = rotations.length;
// note: this mismatch can happen when the avatar's model is actively changing