mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 17:17:11 +02:00
fixes https://github.com/vircadia/vircadia/issues/1015 also: * new mirror and controls poster model. * moved controls poster so it would not be obscured by the wizzard. * updated landing point. * ambient music volume raised a bit, we may want to have a in-worrld toggle for this later https://github.com/vircadia/vircadia/issues/1016. * turned the zone light up a bit so it is not so dark when on low graphic settings.
59 lines
No EOL
2 KiB
JavaScript
59 lines
No EOL
2 KiB
JavaScript
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
// 2020 Silverfish.
|
|
//material sequencer, put on a material entity (server script) to make it iterate through discrete steps of X UV offset.
|
|
|
|
/*UserData:
|
|
{
|
|
"verticalOffset": 0,
|
|
"segments": 16,
|
|
"updateInterval": 250
|
|
}
|
|
*/
|
|
|
|
(function() {
|
|
var DEFAULT_VERTICAL_OFFSET = 0.0;
|
|
var DEFAULT_HORIZONTAL_SPEED = 1;
|
|
var DEFAULT_UPDATE_INTERVAL = 1000;
|
|
var DEFAULT_SEGMENTS = 16;
|
|
|
|
var self = this;
|
|
var _entityID;
|
|
this.preload = function(entityID) {
|
|
_entityID = entityID;
|
|
var verticalOffset = DEFAULT_VERTICAL_OFFSET;
|
|
var updateInterval = DEFAULT_UPDATE_INTERVAL;
|
|
var moveDistance = 1 / DEFAULT_SEGMENTS;
|
|
var verticalOffset = DEFAULT_VERTICAL_OFFSET;
|
|
var oldPosition = 0;
|
|
var currentPosition = 0;
|
|
var userData = JSON.parse(Entities.getEntityProperties(_entityID, ["userData"]).userData);
|
|
if (userData !== undefined) {
|
|
if (userData.segments !== undefined) {
|
|
moveDistance = 1 / userData.segments;
|
|
}
|
|
if (userData.verticalOffset !== undefined) {
|
|
verticalOffset = userData.verticalOffset;
|
|
}
|
|
if (userData.updateInterval !== undefined) {
|
|
updateInterval = userData.updateInterval;
|
|
}
|
|
}
|
|
|
|
self.intervalID = Script.setInterval(function() {
|
|
if(currentPosition >= 1){
|
|
currentPosition = 0;
|
|
oldPosition = 0;
|
|
}
|
|
|
|
Entities.editEntity(_entityID, { materialMappingPos: { x: currentPosition, y: verticalOffset}});
|
|
// print("current Pos: " + currentPosition);
|
|
currentPosition = oldPosition + moveDistance;
|
|
oldPosition = currentPosition;
|
|
}, updateInterval);
|
|
};
|
|
|
|
this.unload = function() {
|
|
Script.clearInterval(self.intervalID);
|
|
}
|
|
}); |