mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:08:51 +02:00
potential fix for the doppleganger "scrunching into a ball" issue
This commit is contained in:
parent
3209a49a7d
commit
708698f079
2 changed files with 32 additions and 4 deletions
File diff suppressed because one or more lines are too long
|
@ -78,6 +78,20 @@ Doppleganger.prototype = {
|
||||||
return this.active;
|
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
|
// @public @method - synchronize the joint data between Avatar / doppleganger
|
||||||
update: function() {
|
update: function() {
|
||||||
this.frame++;
|
this.frame++;
|
||||||
|
@ -91,7 +105,7 @@ Doppleganger.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
var rotations = this.avatar.getJointRotations();
|
var rotations = this.avatar.getJointRotations();
|
||||||
var translations = this.avatar.getJointTranslations();
|
var translations = this._getLocalAvatarJointTranslations(this.avatar);
|
||||||
var size = rotations.length;
|
var size = rotations.length;
|
||||||
|
|
||||||
// note: this mismatch can happen when the avatar's model is actively changing
|
// note: this mismatch can happen when the avatar's model is actively changing
|
||||||
|
|
Loading…
Reference in a new issue