// lightningParticles.js // // Created by Alexia Mandeville on 30 Apr 2018 // al@alexiamandeville.com // // A script to briefly show particles parented to my avatar in High Fidelity on keypress // To run the script, Edit > Running Scripts > Load the script here // When input is provided, I show my lightning particles, parent to my avatar // // High Fidelity docs: https://docs.highfidelity.com/ // Controller.keyPressEvent.connect(function (event) { // More info: https://docs.highfidelity.com/api-reference/namespaces/controller //When I press the L key, show my lightning briefly if(event.text === "l"){ AddEntity(); // Create the entity } }); function AddEntity(){ Entities.addEntity({ // More info:https://docs.highfidelity.com/api-reference/namespaces/entities "accelerationSpread": { "x": 0.009999999776482582, "y": 0.009999999776482582, "z": 0.009999999776482582 }, "lifetime": 1, //Make sure the entity only shows for a small time parentID: MyAvatar.sessionUUID, "alpha": 1, "clientOnly": true, "colorSpread": { "blue": 255, "green": 255, "red": 255 }, "dimensions": { "x": 2.630753517150879, "y": 2.630753517150879, "z": 2.630753517150879 }, "emitAcceleration": { "x": -0.0010000000474974513, "y": -1, "z": -0.0010000000474974513 }, "emitDimensions": { "x": 1, "y": 0, "z": 0 }, "emitOrientation": { "w": 0.9961956143379211, "x": 0.08714515715837479, "y": -1.5, "z": -1.0 }, "emitRate": 5, "emitSpeed": 0.1, "lastEdited": 1523663549048249, "lastEditedBy": "{7493705d-dd55-4110-a7f7-15c53d24425f}", "lifespan": 0.91999979019165, "maxParticles": 2, "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "particleRadius": 0.8, "polarFinish": 3.1415927410125732, "queryAACube": { "scale": 4.556598663330078, "x": -2.278299331665039, "y": -2.278299331665039, "z": -2.278299331665039 }, "radiusFinish": 0.8, "radiusSpread": 0.8, "radiusStart": 0.8, "rotation": { "w": -0.7054398059844971, "x": -1.52587890625e-05, "y": 0.7087968587875366, "z": -1.52587890625e-05 }, "speedSpread": 0, localPosition: Vec3.ZERO, localRotation: Quat.IDENTITY, "textures": "http://hifi-content.s3.amazonaws.com/alexia/Avatars/Stormcloud/lightning.png", "type": "ParticleEffect", "userData": "{\"grabbableKey\":{\"grabbable\":false}}" }, true); }