Merge branch 'master' of github.com:highfidelity/hifi into groups

This commit is contained in:
Seth Alves 2016-07-26 10:08:15 -07:00
commit b9fb4e91d6
2 changed files with 18 additions and 4 deletions

View file

@ -19,6 +19,8 @@ var CONTROLLER_DEAD_SPOT = 0.25;
var TRIGGER_SMOOTH_TIMESCALE = 0.1;
var OVERLAY_RAMP_RATE = 8.0;
var animStateHandlerID;
function clamp(val, min, max) {
return Math.min(Math.max(val, min), max);
}
@ -33,8 +35,10 @@ function lerp(a, b, alpha) {
function init() {
Script.update.connect(update);
MyAvatar.addAnimationStateHandler(animStateHandler, ["leftHandOverlayAlpha", "rightHandOverlayAlpha",
"leftHandGraspAlpha", "rightHandGraspAlpha"]);
animStateHandlerID = MyAvatar.addAnimationStateHandler(
animStateHandler,
["leftHandOverlayAlpha", "rightHandOverlayAlpha", "leftHandGraspAlpha", "rightHandGraspAlpha"]
);
}
function animStateHandler(props) {
@ -72,7 +76,7 @@ function update(dt) {
function shutdown() {
Script.update.disconnect(update);
MyAvatar.removeAnimationStateHandler(animStateHandler);
MyAvatar.removeAnimationStateHandler(animStateHandlerID);
}
Script.scriptEnding.connect(shutdown);

View file

@ -18,11 +18,22 @@
busy: false,
preload: function(entityID) {
this.entityID = entityID;
Entities.editEntity(entityID, {
userData: JSON.stringify({
grabbableKey: {
grabbable: false,
wantsTrigger: true
}
})
});
Script.update.connect(this.update);
},
clickReleaseOnEntity: function() {
this.createSupplies();
},
startFarTrigger: function() {
this.createSupplies();
},
update: function() {
if (_this.busy === true) {
return;
@ -45,7 +56,6 @@
}, 2000)
}
},
createSupplies: function() {
var myProperties = Entities.getEntityProperties(this.entityID);