mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 20:22:22 +02:00
Address #21402 Added a handler to Sit.js script for the onLoadComplete signal to which re-applys the siting animation rol overrides. This works around a bug that shows up if the user switches avatars while the current avatar has overloaded anim roles.
This commit is contained in:
parent
782155e9ea
commit
8cf60df5b0
1 changed files with 14 additions and 1 deletions
|
@ -122,10 +122,21 @@
|
|||
|
||||
this.rolesToOverride = function() {
|
||||
return MyAvatar.getAnimationRoles().filter(function(role) {
|
||||
return role === "fly" || role.startsWith("inAir");
|
||||
return role === "right" || role.startsWith("left");
|
||||
});
|
||||
}
|
||||
|
||||
// Handler for user changing the avatar model while sitting. There's currently an issue with changing avatar models while override role animations are applied,
|
||||
// so to avoid that problem, re-apply the role overrides once the model has finished changing.
|
||||
this.modelURLChangeFinished = function () {
|
||||
print("Sitter's model has FINISHED changing. Reapply anim role overrides.");
|
||||
var roles = this.rolesToOverride();
|
||||
for (i in roles) {
|
||||
//print("Overriding role animation " + roles[i]);
|
||||
MyAvatar.overrideRoleAnimation(roles[i], ANIMATION_URL, ANIMATION_FPS, true, ANIMATION_FIRST_FRAME, ANIMATION_LAST_FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
this.sitDown = function() {
|
||||
if (this.checkSeatForAvatar()) {
|
||||
print("Someone is already sitting in that chair.");
|
||||
|
@ -164,12 +175,14 @@
|
|||
return { headType: 0 };
|
||||
}, ["headType"]);
|
||||
Script.update.connect(this, this.update);
|
||||
MyAvatar.onLoadComplete.connect(this, this.modelURLChangeFinished);
|
||||
}
|
||||
|
||||
this.standUp = function() {
|
||||
print("Standing up (" + this.entityID + ")");
|
||||
MyAvatar.removeAnimationStateHandler(this.animStateHandlerID);
|
||||
Script.update.disconnect(this, this.update);
|
||||
MyAvatar.onLoadComplete.disconnect(this, this.modelURLChangeFinished);
|
||||
|
||||
if (MyAvatar.sessionUUID === this.getSeatUser()) {
|
||||
this.setSeatUser(null);
|
||||
|
|
Loading…
Reference in a new issue