mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:14:35 +02:00
remove floor and move sliders up a bit
This commit is contained in:
parent
b09575dc40
commit
b0bcbb03f2
3 changed files with 92 additions and 41 deletions
|
@ -10,6 +10,19 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Script.include('../libraries/lightOverlayManager.js');
|
||||||
|
// var lightOverlayManager = new LightOverlayManager();
|
||||||
|
// lightOverlayManager.setVisible(true);
|
||||||
|
|
||||||
|
// var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
// var lightResult = lightOverlayManager.findRayIntersection(pickRay)
|
||||||
|
|
||||||
|
|
||||||
|
var DEFAULT_PARENT_ID = '{00000000-0000-0000-0000-000000000000}'
|
||||||
|
var SHOULD_STAY_WITH_AVATAR = false;
|
||||||
|
var VERTICAL_SLIDERS = false;
|
||||||
|
|
||||||
var AXIS_SCALE = 1;
|
var AXIS_SCALE = 1;
|
||||||
var COLOR_MAX = 255;
|
var COLOR_MAX = 255;
|
||||||
var INTENSITY_MAX = 0.05;
|
var INTENSITY_MAX = 0.05;
|
||||||
|
@ -48,10 +61,10 @@ var WHITE = {
|
||||||
blue: 255
|
blue: 255
|
||||||
};
|
};
|
||||||
|
|
||||||
var ORANGE={
|
var ORANGE = {
|
||||||
red:255,
|
red: 255,
|
||||||
green:0,
|
green: 0,
|
||||||
blue:128
|
blue: 128
|
||||||
}
|
}
|
||||||
|
|
||||||
var SLIDER_DIMENSIONS = {
|
var SLIDER_DIMENSIONS = {
|
||||||
|
@ -75,6 +88,7 @@ function entitySlider(light, color, sliderType, row) {
|
||||||
this.verticalOffset = Vec3.multiply(row, PER_ROW_OFFSET);
|
this.verticalOffset = Vec3.multiply(row, PER_ROW_OFFSET);
|
||||||
this.avatarRot = Quat.fromPitchYawRollDegrees(0, MyAvatar.bodyYaw, 0.0);
|
this.avatarRot = Quat.fromPitchYawRollDegrees(0, MyAvatar.bodyYaw, 0.0);
|
||||||
this.basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(this.avatarRot)));
|
this.basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(this.avatarRot)));
|
||||||
|
this.basePosition.y +=1;
|
||||||
|
|
||||||
var message = {
|
var message = {
|
||||||
lightID: this.lightID,
|
lightID: this.lightID,
|
||||||
|
@ -190,6 +204,10 @@ entitySlider.prototype = {
|
||||||
sliderType: this.sliderType,
|
sliderType: this.sliderType,
|
||||||
axisStart: position,
|
axisStart: position,
|
||||||
axisEnd: this.endOfAxis,
|
axisEnd: this.endOfAxis,
|
||||||
|
},
|
||||||
|
releaseVelocityKey: {
|
||||||
|
disableReleaseVelocity: true,
|
||||||
|
customReleaseVelocity: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
@ -201,13 +219,13 @@ entitySlider.prototype = {
|
||||||
|
|
||||||
//message is not for our light
|
//message is not for our light
|
||||||
if (message.lightID !== this.lightID) {
|
if (message.lightID !== this.lightID) {
|
||||||
// print('not our light')
|
// print('not our light')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//message is not our type
|
//message is not our type
|
||||||
if (message.sliderType !== this.sliderType) {
|
if (message.sliderType !== this.sliderType) {
|
||||||
// print('not our slider type')
|
// print('not our slider type')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,8 +399,62 @@ function deleteEntity(entityID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Entities.deletingEntity.connect(deleteEntity);
|
Entities.deletingEntity.connect(deleteEntity);
|
||||||
|
|
||||||
|
// search for lights to make grabbable
|
||||||
|
|
||||||
|
// var USE_DEBOUNCE = true;
|
||||||
|
// var sinceLastUpdate = 0;
|
||||||
|
|
||||||
|
// function searchForLightsToVisualize() {
|
||||||
|
|
||||||
|
// var deltaTime = interval();
|
||||||
|
|
||||||
|
// if (USE_DEBOUNCE === true) {
|
||||||
|
// sinceLastUpdate = sinceLastUpdate + deltaTime;
|
||||||
|
|
||||||
|
// if (sinceLastUpdate > 60) {
|
||||||
|
// sinceLastUpdate = 0;
|
||||||
|
// } else {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print('SEARCHING FOR LIGHTS');
|
||||||
|
|
||||||
|
// var entitites = Entities.findEntities(MyAvatar.position, 50);
|
||||||
|
// for (i = 0; i < entities.length; i++) {
|
||||||
|
// var entityProperties = Entities.getEntityProperties(entities[i], ['type', 'parentID'])
|
||||||
|
// var parentID = entityProperties.parentID;
|
||||||
|
// var type = entityProperties.type;
|
||||||
|
|
||||||
|
// if (type !== 'Light') {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (type === "Light" && parentID !== DEFAULT_PARENT_ID && parentID !== null) {
|
||||||
|
// var light = entities[i];
|
||||||
|
// //do something with the light.
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function interval() {
|
||||||
|
// var lastTime = new Date().getTime();
|
||||||
|
|
||||||
|
// return function getInterval() {
|
||||||
|
// var newTime = new Date().getTime();
|
||||||
|
// var delta = newTime - lastTime;
|
||||||
|
// lastTime = newTime;
|
||||||
|
// return delta;
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//other light properties
|
//other light properties
|
||||||
// diffuseColor: { red: 255, green: 255, blue: 255 },
|
// diffuseColor: { red: 255, green: 255, blue: 255 },
|
||||||
|
|
|
@ -9,39 +9,10 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
var MODEL_LIGHT_POSITION = {
|
|
||||||
x: 0,
|
|
||||||
y: -0.3,
|
|
||||||
z: 0
|
|
||||||
};
|
|
||||||
var MODEL_LIGHT_ROTATION = Quat.angleAxis(-90, {
|
|
||||||
x: 1,
|
|
||||||
y: 0,
|
|
||||||
z: 0
|
|
||||||
});
|
|
||||||
|
|
||||||
var basePosition, avatarRot;
|
var basePosition, avatarRot;
|
||||||
avatarRot = Quat.fromPitchYawRollDegrees(0, MyAvatar.bodyYaw, 0.0);
|
avatarRot = Quat.fromPitchYawRollDegrees(0, MyAvatar.bodyYaw, 0.0);
|
||||||
basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(-3, Quat.getUp(avatarRot)));
|
basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(0, Quat.getUp(avatarRot)));
|
||||||
|
|
||||||
var ground = Entities.addEntity({
|
|
||||||
name: 'Hifi-Light-Mod-Floor',
|
|
||||||
//type: "Model",
|
|
||||||
type: 'Box',
|
|
||||||
color: {
|
|
||||||
red: 100,
|
|
||||||
green: 100,
|
|
||||||
blue: 100
|
|
||||||
},
|
|
||||||
//modelURL: "https://hifi-public.s3.amazonaws.com/eric/models/woodFloor.fbx",
|
|
||||||
dimensions: {
|
|
||||||
x: 100,
|
|
||||||
y: 2,
|
|
||||||
z: 100
|
|
||||||
},
|
|
||||||
position: basePosition,
|
|
||||||
shapeType: 'box'
|
|
||||||
});
|
|
||||||
|
|
||||||
var light, block;
|
var light, block;
|
||||||
|
|
||||||
|
@ -87,7 +58,7 @@ function createLight() {
|
||||||
|
|
||||||
function createBlock() {
|
function createBlock() {
|
||||||
var position = basePosition;
|
var position = basePosition;
|
||||||
position.y += 5;
|
position.y += 3;
|
||||||
var blockProperties = {
|
var blockProperties = {
|
||||||
name: 'Hifi-Spotlight-Block',
|
name: 'Hifi-Spotlight-Block',
|
||||||
type: 'Box',
|
type: 'Box',
|
||||||
|
@ -103,12 +74,22 @@ function createBlock() {
|
||||||
blue: 255
|
blue: 255
|
||||||
},
|
},
|
||||||
position: position
|
position: position
|
||||||
}
|
};
|
||||||
|
|
||||||
block = Entities.addEntity(blockProperties);
|
block = Entities.addEntity(blockProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
function evalLightWorldTransform(modelPos, modelRot) {
|
function evalLightWorldTransform(modelPos, modelRot) {
|
||||||
|
var MODEL_LIGHT_POSITION = {
|
||||||
|
x: 0,
|
||||||
|
y: -0.3,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
var MODEL_LIGHT_ROTATION = Quat.angleAxis(-90, {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
p: Vec3.sum(modelPos, Vec3.multiplyQbyV(modelRot, MODEL_LIGHT_POSITION)),
|
p: Vec3.sum(modelPos, Vec3.multiplyQbyV(modelRot, MODEL_LIGHT_POSITION)),
|
||||||
q: Quat.multiply(modelRot, MODEL_LIGHT_ROTATION)
|
q: Quat.multiply(modelRot, MODEL_LIGHT_ROTATION)
|
||||||
|
@ -117,7 +98,6 @@ function evalLightWorldTransform(modelPos, modelRot) {
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
Entities.deleteEntity(block);
|
Entities.deleteEntity(block);
|
||||||
Entities.deleteEntity(ground);
|
|
||||||
Entities.deleteEntity(light);
|
Entities.deleteEntity(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var AXIS_SCALE = 1;
|
var AXIS_SCALE = 1;
|
||||||
|
@ -61,9 +62,7 @@
|
||||||
this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, EXPONENT_MAX);
|
this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, EXPONENT_MAX);
|
||||||
};
|
};
|
||||||
|
|
||||||
//print('SLIDER VALUE:::' + this.sliderValue)
|
|
||||||
this.sendValueToSlider();
|
this.sendValueToSlider();
|
||||||
|
|
||||||
},
|
},
|
||||||
releaseGrab: function() {
|
releaseGrab: function() {
|
||||||
Entities.editEntity(this.entityID, {
|
Entities.editEntity(this.entityID, {
|
||||||
|
|
Loading…
Reference in a new issue