Merge branch 'master' of github.com:highfidelity/hifi into set-model-entity-joints

This commit is contained in:
Seth Alves 2016-01-05 16:24:10 -08:00
commit 086ea66c04

View file

@ -17,13 +17,14 @@
} }
Target.prototype = { Target.prototype = {
hasPlayedSound: false, hasBecomeActive: false,
preload: function(entityID) { preload: function(entityID) {
this.entityID = entityID; this.entityID = entityID;
var SOUND_URL = "http://hifi-public.s3.amazonaws.com/sounds/Clay_Pigeon_02.L.wav"; var SOUND_URL = "http://hifi-public.s3.amazonaws.com/sounds/Clay_Pigeon_02.L.wav";
this.hitSound = SoundCache.getSound(SOUND_URL); this.hitSound = SoundCache.getSound(SOUND_URL);
}, },
collisionWithEntity: function(me, otherEntity) { collisionWithEntity: function(me, otherEntity) {
if (this.hasBecomeActive === false) {
var position = Entities.getEntityProperties(me, "position").position; var position = Entities.getEntityProperties(me, "position").position;
Entities.editEntity(me, { Entities.editEntity(me, {
gravity: { gravity: {
@ -38,13 +39,12 @@
} }
}); });
if (this.hasPlayedSound === false) {
this.audioInjector = Audio.playSound(this.hitSound, { this.audioInjector = Audio.playSound(this.hitSound, {
position: position, position: position,
volume: 0.5 volume: 0.5
}); });
this.hasPlayedSound = true; this.hasBecomeActive = true;
} }