// // clownGloveDispenser.js // // Created by Thijs Wenker on 8/2/16. // Copyright 2016 High Fidelity, Inc. // // Based on examples/winterSmashUp/targetPractice/shooterPlatform.js // // 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 _this = this; var leftBoxingGlove = undefined; var rightBoxingGlove = undefined; _this.enterEntity = function(entityID) { print('entered boxing glove dispenser entity'); leftBoxingGlove = Entities.addEntity({ position: MyAvatar.position, // collisionSoundURL: "http://hifi-content.s3.amazonaws.com/caitlyn/production/elBoppo/51460__andre-rocha-nascimento__basket-ball-01-bounce.wav", collisionsWillMove: true, dimensions: { x: 0.24890634417533875, y: 0.28214839100837708, z: 0.21127720177173615 }, dynamic: true, gravity: { x: 0, y: -9.8, z: 0 }, modelURL: "http://hifi-content.s3.amazonaws.com/caitlyn/production/elBoppo/LFT_glove_VR3.fbx", name: "Boxing Glove - Left", registrationPoint: { x: 0.5, y: 0, z: 0.5 }, shapeType: "simple-hull", type: "Model", userData: JSON.stringify({ grabbableKey: { invertSolidWhileHeld: true }, wearable: { joints: { LeftHand: [ {x: 0, y: 0.0, z: 0.02 }, Quat.fromVec3Degrees({x: 0, y: 0, z: 0}) ] } } }) }); Messages.sendLocalMessage('Hifi-Hand-Grab', JSON.stringify({hand: 'left', entityID: leftBoxingGlove})); rightBoxingGlove = Entities.addEntity({ position: MyAvatar.position, // collisionSoundURL: "http://hifi-content.s3.amazonaws.com/caitlyn/production/elBoppo/51460__andre-rocha-nascimento__basket-ball-01-bounce.wav", collisionsWillMove: true, dimensions: { x: 0.24890634417533875, y: 0.28214839100837708, z: 0.21127720177173615 }, dynamic: true, gravity: { x: 0, y: -9.8000001907348633, z: 0 }, modelURL: "http://hifi-content.s3.amazonaws.com/caitlyn/production/elBoppo/RT_glove_VR2.fbx", name: "Boxing Glove - Right", registrationPoint: { x: 0.5, y: 0, z: 0.5 }, shapeType: "simple-hull", type: "Model", userData: JSON.stringify({ grabbableKey: { invertSolidWhileHeld: true }, wearable: { joints: { RightHand: [ {x: 0, y: 0.0, z: 0.02 }, Quat.fromVec3Degrees({x: 0, y: 0, z: 0}) ] } } }) }); Messages.sendLocalMessage('Hifi-Hand-Grab', JSON.stringify({hand: 'right', entityID: rightBoxingGlove})); }; _this.leaveEntity = function(entityID) { if (leftBoxingGlove !== undefined) { Entities.deleteEntity(leftBoxingGlove); leftBoxingGlove = undefined; } if (rightBoxingGlove !== undefined) { Entities.deleteEntity(rightBoxingGlove); rightBoxingGlove = undefined; } }; _this.unload = _this.leaveEntity; });