// // attachmentItemScript.js // // Created by Thijs Wenker on 5/30/17. // Copyright 2017 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // (function() { var _entityID = null; var DETACH_SOUND = SoundCache.getSound(Script.resolvePath('sound/detach.wav')); function detachAll(entityID) { if (DETACH_SOUND.downloaded) { Audio.playSound(DETACH_SOUND, { position: Entities.getEntityProperties(_entityID, 'position').position, volume: 0.4, localOnly: true }); } MyAvatar.setAttachmentsVariant([]); } this.preload = function(entityID) { _entityID = entityID; print('loaded ' + entityID); }; this.startFarTrigger = function(entityID, args) { detachAll(); }; this.clickReleaseOnEntity = function(entityID, mouseEvent) { if (mouseEvent.isLeftButton) { detachAll(); } }; });