mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:01:09 +02:00
Merge pull request #8316 from AlexanderOtavka/fix-script-end-errors
Fix script end errors
This commit is contained in:
commit
5ed1e602e6
1 changed files with 7 additions and 3 deletions
|
@ -19,6 +19,8 @@ var CONTROLLER_DEAD_SPOT = 0.25;
|
||||||
var TRIGGER_SMOOTH_TIMESCALE = 0.1;
|
var TRIGGER_SMOOTH_TIMESCALE = 0.1;
|
||||||
var OVERLAY_RAMP_RATE = 8.0;
|
var OVERLAY_RAMP_RATE = 8.0;
|
||||||
|
|
||||||
|
var animStateHandlerID;
|
||||||
|
|
||||||
function clamp(val, min, max) {
|
function clamp(val, min, max) {
|
||||||
return Math.min(Math.max(val, min), max);
|
return Math.min(Math.max(val, min), max);
|
||||||
}
|
}
|
||||||
|
@ -33,8 +35,10 @@ function lerp(a, b, alpha) {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
MyAvatar.addAnimationStateHandler(animStateHandler, ["leftHandOverlayAlpha", "rightHandOverlayAlpha",
|
animStateHandlerID = MyAvatar.addAnimationStateHandler(
|
||||||
"leftHandGraspAlpha", "rightHandGraspAlpha"]);
|
animStateHandler,
|
||||||
|
["leftHandOverlayAlpha", "rightHandOverlayAlpha", "leftHandGraspAlpha", "rightHandGraspAlpha"]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function animStateHandler(props) {
|
function animStateHandler(props) {
|
||||||
|
@ -72,7 +76,7 @@ function update(dt) {
|
||||||
|
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
Script.update.disconnect(update);
|
Script.update.disconnect(update);
|
||||||
MyAvatar.removeAnimationStateHandler(animStateHandler);
|
MyAvatar.removeAnimationStateHandler(animStateHandlerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(shutdown);
|
Script.scriptEnding.connect(shutdown);
|
||||||
|
|
Loading…
Reference in a new issue