From c237485023fec2ac32f077007eba3c02219b9fee Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Fri, 27 Nov 2015 11:21:18 -0800 Subject: [PATCH] revert playaspawner --- examples/playa/playaSpawner.js | 68 +++++++++++----------------------- 1 file changed, 21 insertions(+), 47 deletions(-) diff --git a/examples/playa/playaSpawner.js b/examples/playa/playaSpawner.js index b929a219b9..61101a0e62 100644 --- a/examples/playa/playaSpawner.js +++ b/examples/playa/playaSpawner.js @@ -41,33 +41,21 @@ orientationOf = function(vector) { var ground, wall; var boxes = []; var dustSystems = []; -var ZERO_VEC = { - x: 0, - y: 0, - z: 0 -}; +var ZERO_VEC = {x: 0, y: 0, z: 0}; Script.include("../libraries/utils.js"); function spawnGround() { var groundModelURL = "https://hifi-public.s3.amazonaws.com/alan/Playa/Ground.fbx"; - var groundPosition = Vec3.sum(MyAvatar.position, { - x: 0, - y: -2, - z: 0 - }); + var groundPosition = Vec3.sum(MyAvatar.position, {x: 0, y: -2, z: 0}); ground = Entities.addEntity({ type: "Model", modelURL: groundModelURL, shapeType: "box", position: groundPosition, - dimensions: { - x: 900, - y: 0.82, - z: 900 - }, + dimensions: {x: 900, y: 0.82, z: 900}, }); - // Script.addEventHandler(ground, "collisionWithEntity", entityCollisionWithGround); + // Script.addEventHandler(ground, "collisionWithEntity", entityCollisionWithGround); } @@ -92,7 +80,7 @@ function spawnGround() { isEmitting: true, polarStart: Math.PI/2, polarFinish: Math.PI/2, - emitOrientation: orientationChange, + emitOrientation: orientationChange, radiusSpread: 0.1, radiusStart: particleRadius, radiusFinish: particleRadius + particleRadius/2, @@ -118,11 +106,7 @@ function spawnBoxes() { var numBoxes = 200; var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))); for (var i = 0; i < numBoxes; i++) { - var position = Vec3.sum(center, { - x: Math.random() * numBoxes, - y: Math.random() * 3, - z: Math.random() * numBoxes - }) + var position = Vec3.sum(center, {x: Math.random() * numBoxes, y: Math.random() * 3, z: Math.random() * numBoxes }) var box = Entities.addEntity({ type: "Model", modelURL: boxModelURL, @@ -130,21 +114,9 @@ function spawnBoxes() { shapeType: "box", position: position, collisionsWillMove: true, - dimensions: { - x: 1, - y: 2, - z: 3 - }, - velocity: { - x: 0, - y: -.01, - z: 0 - }, - gravity: { - x: 0, - y: -2.5 - Math.random() * 6, - z: 0 - } + dimensions: {x: 1, y: 2, z: 3}, + velocity: {x: 0, y: -.01, z: 0}, + gravity: {x: 0, y: -2.5 - Math.random() * 6, z: 0} }); boxes.push(box); @@ -155,14 +127,16 @@ spawnGround(); spawnBoxes(); -// function cleanup() { -// Entities.deleteEntity(ground); -// boxes.forEach(function(box) { -// Entities.deleteEntity(box); -// }); -// dustSystems.forEach(function(dustEffect) { -// Entities.deleteEntity(dustEffect); -// }) -// } +function cleanup() { + Entities.deleteEntity(ground); + boxes.forEach(function(box){ + Entities.deleteEntity(box); + }); + dustSystems.forEach(function(dustEffect) { + Entities.deleteEntity(dustEffect); + }) +} + +Script.scriptEnding.connect(cleanup); + -// Script.scriptEnding.connect(cleanup); \ No newline at end of file