// // BetterClientSimulationBotFromRecording.js // examples // // Created by Brad Hefta-Gaub on 2/6/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 // randFloat = function(low, high) { return low + Math.random() * (high - low); } var RECORDINGS_ARRAY = [ "eventer1.hfr", // "cop1.hfr", // Bad Model // "cop2.hfr", // Bad Model "waiting1.hfr", "waiting2.hfr", // "waiting3.hfr", // Bad Model "waiting4.hfr", // "waiting5.hfr", // Moves downward //"waiting6.hfr", //bad audio? // "waiting7.hfr", // Bad Model //"waiting8.hfr", // bad audio? "waiting9.hfr", "waiting10.hfr", "bot1.hfr", "bot2.hfr", "bot3.hfr", "bot4.hfr", "check_12.hfr", "peanuts.hfr", "claude.hfr"/*, "usher1.hfr", "usher2.hfr", "usher3.hfr", "jim.hfr"*/ ]; var RECORDING_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Event%20/NPC%27s/" + RECORDINGS_ARRAY[Math.floor(Math.random() * RECORDINGS_ARRAY.length)]; print("RANDOM RECORDING SELECTED:" + RECORDING_URL); var LOCATIONS_ARRAY = [{ min_x: 42, max_x: 63, y: -12.8, min_z: -49, max_z: -40}]; var LOCATION_PARAMS = LOCATIONS_ARRAY[Math.floor(Math.random() * LOCATIONS_ARRAY.length)]; var LOCATION = { x: randFloat(LOCATION_PARAMS.min_x, LOCATION_PARAMS.max_x), y: LOCATION_PARAMS.y, z: randFloat(LOCATION_PARAMS.min_z, LOCATION_PARAMS.max_z) }; Vec3.print("RANDOM LOCATION SELECTED:", LOCATION); // Disable the privacy bubble Users.disableIgnoreRadius(); // Set position here if playFromCurrentLocation is true Avatar.position = LOCATION; Avatar.orientation = Quat.fromPitchYawRollDegrees(0, randFloat(0, 360), 0); Avatar.scale = 1.0; Agent.isAvatar = true; Script.update.connect(update); var count = 100; // Randomly wait some period of time before starting the recording function update(event) { count--; if (count == -2) { Script.stop(); } }