68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
//
|
|
// Created by Thijs Wenker on 5/10/2017
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
// To enable voxelPaint test/debug mode:
|
|
// Settings.setValue('io.highfidelity.VoxelPaint.DEBUG', true);
|
|
// To disable:
|
|
// Settings.setValue('io.highfidelity.VoxelPaint.DEBUG', false);
|
|
// Warning: the debug setting persists during restarts
|
|
|
|
var shared = Script.require('./voxel-paint-shared.js');
|
|
|
|
var TEST_MODE = shared.DEBUG;
|
|
|
|
function createVoxelPaintRezzer() {
|
|
var properties = {
|
|
collisionless: true,
|
|
description: 'Put this in the corner and click it',
|
|
dimensions: Vec3.multiply({
|
|
x: 2.4959230422973633,
|
|
y: 2.6838736534118652,
|
|
z: 2.5039944648742676
|
|
}, 0.4),
|
|
ignoreForCollisions: true,
|
|
modelURL: shared.MODELS_PATH + 'arrows.fbx',
|
|
name: 'VoxelPaintRezzer',
|
|
|
|
registrationPoint: {
|
|
x: 0,
|
|
y: 0.5,
|
|
z: 0
|
|
},
|
|
rotation: {
|
|
w: -4.57763671875e-05,
|
|
x: 1.52587890625e-05,
|
|
y: -1,
|
|
z: -1.52587890625e-05
|
|
},
|
|
script: Script.resolvePath('voxel-paint-init.js'),
|
|
shapeType: 'static-mesh',
|
|
type: 'Model',
|
|
userData: JSON.stringify({
|
|
grabbableKey: {
|
|
wantsTrigger: true
|
|
}
|
|
}),
|
|
position: MyAvatar.position
|
|
};
|
|
if (shared.DEBUG) {
|
|
properties.scriptTimestamp = Date.now();
|
|
}
|
|
return Entities.addEntity(properties);
|
|
}
|
|
|
|
var voxelPaintRezzer = createVoxelPaintRezzer();
|
|
|
|
if (TEST_MODE) {
|
|
Script.scriptEnding.connect(function() {
|
|
Entities.deleteEntity(voxelPaintRezzer);
|
|
});
|
|
} else {
|
|
Script.stop();
|
|
}
|