mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 02:35:56 +02:00
2 sizes for blocks
This commit is contained in:
parent
8ada3dec6e
commit
86dfa6f590
1 changed files with 15 additions and 12 deletions
|
@ -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));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue