revert playaspawner

This commit is contained in:
James B. Pollack 2015-11-27 11:21:18 -08:00
parent 8e81c3252a
commit c237485023

View file

@ -41,33 +41,21 @@ orientationOf = function(vector) {
var ground, wall; var ground, wall;
var boxes = []; var boxes = [];
var dustSystems = []; var dustSystems = [];
var ZERO_VEC = { var ZERO_VEC = {x: 0, y: 0, z: 0};
x: 0,
y: 0,
z: 0
};
Script.include("../libraries/utils.js"); Script.include("../libraries/utils.js");
function spawnGround() { function spawnGround() {
var groundModelURL = "https://hifi-public.s3.amazonaws.com/alan/Playa/Ground.fbx"; var groundModelURL = "https://hifi-public.s3.amazonaws.com/alan/Playa/Ground.fbx";
var groundPosition = Vec3.sum(MyAvatar.position, { var groundPosition = Vec3.sum(MyAvatar.position, {x: 0, y: -2, z: 0});
x: 0,
y: -2,
z: 0
});
ground = Entities.addEntity({ ground = Entities.addEntity({
type: "Model", type: "Model",
modelURL: groundModelURL, modelURL: groundModelURL,
shapeType: "box", shapeType: "box",
position: groundPosition, position: groundPosition,
dimensions: { dimensions: {x: 900, y: 0.82, z: 900},
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, isEmitting: true,
polarStart: Math.PI/2, polarStart: Math.PI/2,
polarFinish: Math.PI/2, polarFinish: Math.PI/2,
emitOrientation: orientationChange, emitOrientation: orientationChange,
radiusSpread: 0.1, radiusSpread: 0.1,
radiusStart: particleRadius, radiusStart: particleRadius,
radiusFinish: particleRadius + particleRadius/2, radiusFinish: particleRadius + particleRadius/2,
@ -118,11 +106,7 @@ function spawnBoxes() {
var numBoxes = 200; var numBoxes = 200;
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));
for (var i = 0; i < numBoxes; i++) { for (var i = 0; i < numBoxes; i++) {
var position = Vec3.sum(center, { var position = Vec3.sum(center, {x: Math.random() * numBoxes, y: Math.random() * 3, z: Math.random() * numBoxes })
x: Math.random() * numBoxes,
y: Math.random() * 3,
z: Math.random() * numBoxes
})
var box = Entities.addEntity({ var box = Entities.addEntity({
type: "Model", type: "Model",
modelURL: boxModelURL, modelURL: boxModelURL,
@ -130,21 +114,9 @@ function spawnBoxes() {
shapeType: "box", shapeType: "box",
position: position, position: position,
collisionsWillMove: true, collisionsWillMove: true,
dimensions: { dimensions: {x: 1, y: 2, z: 3},
x: 1, velocity: {x: 0, y: -.01, z: 0},
y: 2, gravity: {x: 0, y: -2.5 - Math.random() * 6, z: 0}
z: 3
},
velocity: {
x: 0,
y: -.01,
z: 0
},
gravity: {
x: 0,
y: -2.5 - Math.random() * 6,
z: 0
}
}); });
boxes.push(box); boxes.push(box);
@ -155,14 +127,16 @@ spawnGround();
spawnBoxes(); spawnBoxes();
// function cleanup() { function cleanup() {
// Entities.deleteEntity(ground); Entities.deleteEntity(ground);
// boxes.forEach(function(box) { boxes.forEach(function(box){
// Entities.deleteEntity(box); Entities.deleteEntity(box);
// }); });
// dustSystems.forEach(function(dustEffect) { dustSystems.forEach(function(dustEffect) {
// Entities.deleteEntity(dustEffect); Entities.deleteEntity(dustEffect);
// }) })
// } }
Script.scriptEnding.connect(cleanup);
// Script.scriptEnding.connect(cleanup);