Added lifetime and better notes, per PR

This commit is contained in:
Philip Rosedale 2015-08-05 10:04:59 -07:00
parent c83bcf77c6
commit f1a4e185cd

View file

@ -7,17 +7,22 @@
// //
// Creates a rectangular grid of objects, starting at the origin and proceeding along the X/Z plane. // Creates a rectangular grid of objects, starting at the origin and proceeding along the X/Z plane.
// Useful for testing the rendering, LOD, and octree storage aspects of the system. // Useful for testing the rendering, LOD, and octree storage aspects of the system.
// //
// Note that when creating things quickly, the entity server will ignore data if we send updates too quickly.
// like Internet MTU, these rates are set by th domain operator, so in this script there is a RATE_PER_SECOND
// variable letting you set this speed. If entities are missing from the grid after a relog, this number
// being too high may be the reason.
var SIZE = 10.0; var SIZE = 10.0;
var SEPARATION = 20.0; var SEPARATION = 20.0;
var ROWS_X = 30; var ROWS_X = 30;
var ROWS_Z = 30; var ROWS_Z = 30;
var TYPE = "Sphere"; // Right now this can be "Box" or "Model" or "Sphere" var TYPE = "Sphere"; // Right now this can be "Box" or "Model" or "Sphere"
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/props/LowPolyIsland/CypressTreeGroup.fbx"; var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/props/LowPolyIsland/CypressTreeGroup.fbx";
var MODEL_DIMENSION = { x: 33, y: 16, z: 49 }; var MODEL_DIMENSION = { x: 33, y: 16, z: 49 };
var RATE_PER_SECOND = 1000; var RATE_PER_SECOND = 1000; // The entity server will drop data if we create things too fast.
var SCRIPT_INTERVAL = 100; var SCRIPT_INTERVAL = 100;
var LIFETIME = 600; // By default, these entities will live in the server for 10 minutes
var addRandom = false; var addRandom = false;
@ -41,7 +46,8 @@ Script.setInterval(function () {
position: position, position: position,
dimensions: MODEL_DIMENSION, dimensions: MODEL_DIMENSION,
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false collisionsWillMove: false,
lifetime: LIFETIME
}); });
} else { } else {
Entities.addEntity({ Entities.addEntity({
@ -51,7 +57,8 @@ Script.setInterval(function () {
dimensions: { x: SIZE, y: SIZE, z: SIZE }, dimensions: { x: SIZE, y: SIZE, z: SIZE },
color: { red: x / ROWS_X * 255, green: 50, blue: z / ROWS_Z * 255 }, color: { red: x / ROWS_X * 255, green: 50, blue: z / ROWS_Z * 255 },
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false collisionsWillMove: false,
lifetime: LIFETIME
}); });
} }