mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:40:20 +02:00
alignments
This commit is contained in:
parent
d77abc2aba
commit
62728aa507
1 changed files with 39 additions and 40 deletions
|
@ -19,8 +19,8 @@ var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_g
|
||||||
|
|
||||||
var RESET_DISTANCE = 1;
|
var RESET_DISTANCE = 1;
|
||||||
var TARGET_USER_DATA_KEY = 'hifi-ping_pong_target';
|
var TARGET_USER_DATA_KEY = 'hifi-ping_pong_target';
|
||||||
var NUMBER_OF_TARGETS = 6;
|
var NUMBER_OF_TARGETS = 8;
|
||||||
var TARGETS_PER_ROW = 3;
|
var TARGETS_PER_ROW = 4;
|
||||||
|
|
||||||
var TARGET_DIMENSIONS = {
|
var TARGET_DIMENSIONS = {
|
||||||
x: 0.03,
|
x: 0.03,
|
||||||
|
@ -28,16 +28,8 @@ var TARGET_DIMENSIONS = {
|
||||||
z: 0.21
|
z: 0.21
|
||||||
};
|
};
|
||||||
|
|
||||||
var VERTICAL_SPACING = 0.3;
|
var VERTICAL_SPACING = 0.5;
|
||||||
var NUM_ROWS = 2;
|
var HORIZONTAL_SPACING = TARGET_DIMENSIONS.z + 0.5;
|
||||||
var NUM_COLUMNS = 3;
|
|
||||||
var spacingVector = {x: 1.4, y: 0, z: -0.93};
|
|
||||||
var HORIZONTAL_SPACING = Vec3.multiply(Vec3.normalize(spacingVector), 0.5);
|
|
||||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
|
||||||
x: 0,
|
|
||||||
y: 0.5,
|
|
||||||
z: 0
|
|
||||||
}), Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));
|
|
||||||
|
|
||||||
|
|
||||||
var startPosition = {
|
var startPosition = {
|
||||||
|
@ -49,17 +41,21 @@ var startPosition = {
|
||||||
// var rotation = Quat.fromPitchYawRollDegrees(0, -54, 0.0);
|
// var rotation = Quat.fromPitchYawRollDegrees(0, -54, 0.0);
|
||||||
|
|
||||||
// var startPosition = center;
|
// var startPosition = center;
|
||||||
|
var rotation = Quat.fromPitchYawRollDegrees(0,-55.25,0);
|
||||||
|
|
||||||
var targetIntervalClearer = Entities.addEntity({
|
var targetIntervalClearer = Entities.addEntity({
|
||||||
name: 'Target Interval Clearer - delete me to clear',
|
name: 'Target Interval Clearer - delete me to clear',
|
||||||
type: 'Box',
|
type: 'Box',
|
||||||
position: startPosition,
|
position: startPosition,
|
||||||
dimensions: {
|
dimensions: TARGET_DIMENSIONS,
|
||||||
x: 1,
|
color: {
|
||||||
y: 1,
|
red: 0,
|
||||||
z: 1
|
green: 255,
|
||||||
|
blue: 0
|
||||||
},
|
},
|
||||||
|
rotation:rotation,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
collisionsWillMove: false,
|
||||||
ignoreForCollisions: true,
|
ignoreForCollisions: true,
|
||||||
})
|
})
|
||||||
var targets = [];
|
var targets = [];
|
||||||
|
@ -67,34 +63,37 @@ var targets = [];
|
||||||
var originalPositions = [];
|
var originalPositions = [];
|
||||||
|
|
||||||
function addTargets() {
|
function addTargets() {
|
||||||
var i, rowIndex, columnIndex;
|
var i;
|
||||||
var row = -1;
|
var row = -1;
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(-80, -48, -11);
|
for (i = 0; i < NUMBER_OF_TARGETS; i++) {
|
||||||
for (rowIndex = 0; rowIndex < NUM_ROWS; rowIndex++) {
|
if (i % TARGETS_PER_ROW === 0) {
|
||||||
for (columnIndex = 0; columnIndex < NUM_COLUMNS; columnIndex++) {
|
row++;
|
||||||
|
|
||||||
var position = Vec3.sum(startPosition, Vec3.multiply(HORIZONTAL_SPACING, columnIndex));
|
|
||||||
|
|
||||||
originalPositions.push(position);
|
|
||||||
var targetProperties = {
|
|
||||||
name: 'Target',
|
|
||||||
type: 'Model',
|
|
||||||
modelURL: MODEL_URL,
|
|
||||||
shapeType: 'compound',
|
|
||||||
collisionsWillMove: true,
|
|
||||||
dimensions: TARGET_DIMENSIONS,
|
|
||||||
compoundShapeURL: COLLISION_HULL_URL,
|
|
||||||
position: position,
|
|
||||||
rotation:rotation,
|
|
||||||
script: scriptURL
|
|
||||||
};
|
|
||||||
targets.push(Entities.addEntity(targetProperties));
|
|
||||||
}
|
}
|
||||||
startPosition = Vec3.sum(startPosition, {x: 0, y: VERTICAL_SPACING, z: 0});
|
|
||||||
|
var vHat = Quat.getFront(rotation);
|
||||||
|
var spacer = HORIZONTAL_SPACING * (i % TARGETS_PER_ROW)+(row * HORIZONTAL_SPACING / 2);
|
||||||
|
var multiplier = Vec3.multiply(spacer, vHat);
|
||||||
|
var position = Vec3.sum(startPosition, multiplier);
|
||||||
|
position.y = startPosition.y-(row*VERTICAL_SPACING);
|
||||||
|
|
||||||
|
print('position::: ' + JSON.stringify(position));
|
||||||
|
originalPositions.push(position);
|
||||||
|
var targetProperties = {
|
||||||
|
name: 'Target',
|
||||||
|
type: 'Model',
|
||||||
|
modelURL: MODEL_URL,
|
||||||
|
shapeType: 'compound',
|
||||||
|
collisionsWillMove: true,
|
||||||
|
dimensions: TARGET_DIMENSIONS,
|
||||||
|
compoundShapeURL: COLLISION_HULL_URL,
|
||||||
|
position: position,
|
||||||
|
rotation: rotation,
|
||||||
|
script: scriptURL
|
||||||
|
};
|
||||||
|
targets.push(Entities.addEntity(targetProperties));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testTargetDistanceFromStart() {
|
function testTargetDistanceFromStart() {
|
||||||
print('TEST TARGET DISTANCE FROM START')
|
print('TEST TARGET DISTANCE FROM START')
|
||||||
var resetCount = 0;
|
var resetCount = 0;
|
||||||
|
@ -115,7 +114,7 @@ function testTargetDistanceFromStart() {
|
||||||
dimensions: TARGET_DIMENSIONS,
|
dimensions: TARGET_DIMENSIONS,
|
||||||
compoundShapeURL: COLLISION_HULL_URL,
|
compoundShapeURL: COLLISION_HULL_URL,
|
||||||
position: originalPositions[index],
|
position: originalPositions[index],
|
||||||
// rotation:rotation,
|
rotation: rotation,
|
||||||
script: scriptURL
|
script: scriptURL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue