2 sizes for blocks

This commit is contained in:
ericrius1 2015-09-18 12:35:49 -07:00
parent 8ada3dec6e
commit 86dfa6f590

View file

@ -163,12 +163,11 @@ function createSprayCan(position) {
function createBlocks(position) { function createBlocks(position) {
var modelUrl = HIFI_PUBLIC_BUCKET + 'marketplace/hificontent/Games/blocks/block.fbx'; var modelUrl = HIFI_PUBLIC_BUCKET + 'marketplace/hificontent/Games/blocks/block.fbx';
var BASE_DIMENSIONS = Vec3.multiply({ var dimensionsArray = [
x: 0.2, {x: .1, y: 0.05, z: 0.25},
y: 0.1, {x: 0.06, y: 0.04, z: 0.28}
z: 0.8 ];
}, 0.2); var NUM_BLOCKS = 12;
var NUM_BLOCKS = 4;
for (var i = 0; i < NUM_BLOCKS; i++) { for (var i = 0; i < NUM_BLOCKS; i++) {
var entity = Entities.addEntity({ var entity = Entities.addEntity({
@ -181,11 +180,7 @@ function createBlocks(position) {
}), }),
shapeType: 'box', shapeType: 'box',
name: "block", name: "block",
dimensions: Vec3.sum(BASE_DIMENSIONS, { dimensions: dimensionsArray[randInt(0, dimensionsArray.length)],
x: Math.random() / 10,
y: Math.random() / 10,
z: Math.random() / 10
}),
collisionsWillMove: true, collisionsWillMove: true,
gravity: { gravity: {
x: 0, x: 0,
@ -210,4 +205,12 @@ function cleanup() {
deleteAllToys(); deleteAllToys();
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);
function randFloat(low, high) {
return low + Math.random() * (high - low);
}
function randInt(low, high) {
return Math.floor(randFloat(low, high));
}