mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:53:01 +02:00
commit
e92b4029b2
4 changed files with 244 additions and 45 deletions
|
@ -38,11 +38,11 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
},
|
},
|
||||||
position: spawnPosition,
|
position: spawnPosition,
|
||||||
rotation: clockRotation,
|
rotation: clockRotation,
|
||||||
dimensions: {
|
dimensions: Vec3.multiply(0.5, {
|
||||||
x: 0.8181,
|
x: 0.8181,
|
||||||
y: 1.3662,
|
y: 1.3662,
|
||||||
z: 0.8181
|
z: 0.8181
|
||||||
},
|
}),
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
hifiHomeKey: {
|
hifiHomeKey: {
|
||||||
reset: true
|
reset: true
|
||||||
|
@ -50,9 +50,9 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
var forwardOffset = -0.13
|
var forwardOffset = 0.5 * -0.13;
|
||||||
var upOffset = 0.255;
|
var upOffset = 0.5 * 0.255;
|
||||||
var sideOffset = -0.03;
|
var sideOffset = 0.5 * -0.03;
|
||||||
var clockFacePosition = spawnPosition;
|
var clockFacePosition = spawnPosition;
|
||||||
clockFacePosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getFront(clockRotation), forwardOffset));
|
clockFacePosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getFront(clockRotation), forwardOffset));
|
||||||
clockFacePosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getUp(clockRotation), upOffset));
|
clockFacePosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getUp(clockRotation), upOffset));
|
||||||
|
@ -65,11 +65,11 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
name: "home_model_clockFace",
|
name: "home_model_clockFace",
|
||||||
modelURL: CLOCK_FACE_URL,
|
modelURL: CLOCK_FACE_URL,
|
||||||
position: clockFacePosition,
|
position: clockFacePosition,
|
||||||
dimensions: {
|
dimensions: Vec3.multiply(0.5, {
|
||||||
x: 0.2397,
|
x: 0.2397,
|
||||||
y: 0.2402,
|
y: 0.2402,
|
||||||
z: 0.0212
|
z: 0.0212
|
||||||
},
|
}),
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
hifiHomeKey: {
|
hifiHomeKey: {
|
||||||
reset: true
|
reset: true
|
||||||
|
@ -86,7 +86,7 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
|
|
||||||
var myDate = new Date()
|
var myDate = new Date()
|
||||||
// HOUR HAND *************************
|
// HOUR HAND *************************
|
||||||
var clockHandForwardOffset = -0.017;
|
var clockHandForwardOffset = (0.5 * -0.017);
|
||||||
|
|
||||||
|
|
||||||
var hourHandPosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getFront(clockRotation), clockHandForwardOffset));
|
var hourHandPosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getFront(clockRotation), clockHandForwardOffset));
|
||||||
|
@ -118,11 +118,11 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
rotation: worldClockHandRotation,
|
rotation: worldClockHandRotation,
|
||||||
angularDamping: 0,
|
angularDamping: 0,
|
||||||
angularVelocity: worldAngularVelocity,
|
angularVelocity: worldAngularVelocity,
|
||||||
dimensions: {
|
dimensions: Vec3.multiply(0.5, {
|
||||||
x: 0.0263,
|
x: 0.0263,
|
||||||
y: 0.0982,
|
y: 0.0982,
|
||||||
z: 0.0024
|
z: 0.0024
|
||||||
},
|
}),
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
hifiHomeKey: {
|
hifiHomeKey: {
|
||||||
reset: true
|
reset: true
|
||||||
|
@ -150,11 +150,11 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
modelURL: CLOCK_SECOND_HAND_URL,
|
modelURL: CLOCK_SECOND_HAND_URL,
|
||||||
name: "home_model_clockSecondHand",
|
name: "home_model_clockSecondHand",
|
||||||
position: hourHandPosition,
|
position: hourHandPosition,
|
||||||
dimensions: {
|
dimensions: Vec3.multiply(0.5, {
|
||||||
x: 0.0043,
|
x: 0.0043,
|
||||||
y: 0.1117,
|
y: 0.1117,
|
||||||
z: 0.0008
|
z: 0.0008
|
||||||
},
|
}),
|
||||||
color: {
|
color: {
|
||||||
red: 200,
|
red: 200,
|
||||||
green: 10,
|
green: 10,
|
||||||
|
@ -205,11 +205,11 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
rotation: worldClockHandRotation,
|
rotation: worldClockHandRotation,
|
||||||
angularDamping: 0,
|
angularDamping: 0,
|
||||||
angularVelocity: worldAngularVelocity,
|
angularVelocity: worldAngularVelocity,
|
||||||
dimensions: {
|
dimensions: Vec3.multiply(0.5, {
|
||||||
x: 0.0251,
|
x: 0.0251,
|
||||||
y: 0.1179,
|
y: 0.1179,
|
||||||
z: 0.0032
|
z: 0.0032
|
||||||
},
|
}),
|
||||||
script: MINUTE_HAND_CLOCK_SCRIPT_URL,
|
script: MINUTE_HAND_CLOCK_SCRIPT_URL,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
clockBody: clockBody,
|
clockBody: clockBody,
|
||||||
|
|
165
unpublishedScripts/DomainContent/Home/firePit/fire.js
Normal file
165
unpublishedScripts/DomainContent/Home/firePit/fire.js
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
// this script turns an entity into an exploder -- anything that collides with it will be vaporized!
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
function Fire() {
|
||||||
|
_this = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
var RED = {
|
||||||
|
red: 255,
|
||||||
|
green: 0,
|
||||||
|
blue: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var ORANGE = {
|
||||||
|
red: 255,
|
||||||
|
green: 165,
|
||||||
|
blue: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var YELLOW = {
|
||||||
|
red: 255,
|
||||||
|
green: 255,
|
||||||
|
blue: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var GREEN = {
|
||||||
|
red: 0,
|
||||||
|
green: 255,
|
||||||
|
blue: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var BLUE = {
|
||||||
|
red: 0,
|
||||||
|
green: 0,
|
||||||
|
blue: 255
|
||||||
|
};
|
||||||
|
|
||||||
|
var INDIGO = {
|
||||||
|
red: 128,
|
||||||
|
green: 0,
|
||||||
|
blue: 128
|
||||||
|
};
|
||||||
|
|
||||||
|
var VIOLET = {
|
||||||
|
red: 75,
|
||||||
|
green: 0,
|
||||||
|
blue: 130
|
||||||
|
};
|
||||||
|
|
||||||
|
var colors = [RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET];
|
||||||
|
|
||||||
|
Fire.prototype = {
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
this.EXPLOSION_SOUND = SoundCache.getSound("atp:/firepit/fire_burst.wav");
|
||||||
|
|
||||||
|
},
|
||||||
|
collisionWithEntity: function(myID, otherID, collisionInfo) {
|
||||||
|
var otherProps = Entities.getEntityProperties(otherID);
|
||||||
|
var data = null;
|
||||||
|
try {
|
||||||
|
data = JSON.parse(otherProps.userData)
|
||||||
|
} catch (err) {
|
||||||
|
print('ERROR GETTING USERDATA!');
|
||||||
|
}
|
||||||
|
if (data === null || "") {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (data.hasOwnProperty('hifiHomeKey')) {
|
||||||
|
if (data.hifiHomeKey.reset === true) {
|
||||||
|
print('FLAMMABLE THING, EXPLODE IT!');
|
||||||
|
_this.playSoundAtCurrentPosition();
|
||||||
|
_this.explodeWithColor();
|
||||||
|
_this.smokePuff();
|
||||||
|
Entities.deleteEntity(otherID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
explodeWithColor: function() {
|
||||||
|
print('EXPLODE!')
|
||||||
|
var myProps = Entities.getEntityProperties(this.entityID);
|
||||||
|
var color = colors[Math.floor(Math.random() * colors.length)];
|
||||||
|
var explosionParticleProperties = {
|
||||||
|
"color": color,
|
||||||
|
"isEmitting": 1,
|
||||||
|
"maxParticles": 1000,
|
||||||
|
"lifespan": 0.25,
|
||||||
|
"emitRate": 1,
|
||||||
|
"emitSpeed": 0.1,
|
||||||
|
"speedSpread": 1,
|
||||||
|
"emitOrientation": Quat.getUp(myProps.rotation),
|
||||||
|
"emitDimensions": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"polarStart": 0,
|
||||||
|
"polarFinish": 0,
|
||||||
|
"azimuthStart": 0,
|
||||||
|
"azimuthFinish": 0,
|
||||||
|
"emitAcceleration": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"accelerationSpread": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"particleRadius": 0.829,
|
||||||
|
"radiusSpread": 0,
|
||||||
|
"radiusStart": 0.361,
|
||||||
|
"radiusFinish": 0.294,
|
||||||
|
"colorSpread": {
|
||||||
|
"red": 0,
|
||||||
|
"green": 0,
|
||||||
|
"blue": 0
|
||||||
|
},
|
||||||
|
"colorStart": {
|
||||||
|
"red": 255,
|
||||||
|
"green": 255,
|
||||||
|
"blue": 255
|
||||||
|
},
|
||||||
|
"colorFinish": {
|
||||||
|
"red": 255,
|
||||||
|
"green": 255,
|
||||||
|
"blue": 255
|
||||||
|
},
|
||||||
|
"alpha": 1,
|
||||||
|
"alphaSpread": 0,
|
||||||
|
"alphaStart": -0.2,
|
||||||
|
"alphaFinish": 0.5,
|
||||||
|
"emitterShouldTrail": 0,
|
||||||
|
"textures": "atp:/firepit/explode.png",
|
||||||
|
"type": "ParticleEffect",
|
||||||
|
lifetime: 1,
|
||||||
|
position: myProps.position
|
||||||
|
};
|
||||||
|
|
||||||
|
var explosion = Entities.addEntity(explosionParticleProperties);
|
||||||
|
print('explosion is: ' + explosion)
|
||||||
|
},
|
||||||
|
smokePuff: function() {
|
||||||
|
//smoke puff here
|
||||||
|
},
|
||||||
|
playSoundAtCurrentPosition: function() {
|
||||||
|
|
||||||
|
var audioProperties = {
|
||||||
|
volume: 0.5,
|
||||||
|
position: Entities.getEntityProperties(this.entityID).position
|
||||||
|
};
|
||||||
|
|
||||||
|
Audio.playSound(this.EXPLOSION_SOUND, audioProperties);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Fire();
|
||||||
|
});
|
51
unpublishedScripts/DomainContent/Home/firePit/flicker.js
Normal file
51
unpublishedScripts/DomainContent/Home/firePit/flicker.js
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
var MINIMUM_LIGHT_INTENSITY = 50.0;
|
||||||
|
var MAXIMUM_LIGHT_INTENSITY = 200.0;
|
||||||
|
var LIGHT_FALLOFF_RADIUS = 0.1;
|
||||||
|
var LIGHT_INTENSITY_RANDOMNESS = 0.1;
|
||||||
|
|
||||||
|
function randFloat(low, high) {
|
||||||
|
return low + Math.random() * (high - low);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
function FlickeringFlame() {
|
||||||
|
_this = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
var totalTime = 0;
|
||||||
|
var spacer = 2;
|
||||||
|
FlickeringFlame.prototype = {
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
Script.update.connect(this.update);
|
||||||
|
},
|
||||||
|
update: function(deltaTime) {
|
||||||
|
|
||||||
|
totalTime += deltaTime;
|
||||||
|
if (totalTime > spacer) {
|
||||||
|
var howManyAvatars = AvatarList.getAvatarIdentifiers().length;
|
||||||
|
var intensity = (MINIMUM_LIGHT_INTENSITY + (MAXIMUM_LIGHT_INTENSITY + (Math.sin(totalTime) * MAXIMUM_LIGHT_INTENSITY)));
|
||||||
|
intensity += randFloat(-LIGHT_INTENSITY_RANDOMNESS, LIGHT_INTENSITY_RANDOMNESS);
|
||||||
|
|
||||||
|
Entities.editEntity(_this.entityID, {
|
||||||
|
intensity: intensity
|
||||||
|
});
|
||||||
|
|
||||||
|
spacer = Math.random(0, 100) * (2 / howManyAvatars);
|
||||||
|
totalTime = 0;
|
||||||
|
} else {
|
||||||
|
//just keep counting
|
||||||
|
}
|
||||||
|
},
|
||||||
|
unload: function() {
|
||||||
|
Script.update.disconnect(this.update)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new FlickeringFlame
|
||||||
|
|
||||||
|
|
||||||
|
});
|
|
@ -37,14 +37,10 @@
|
||||||
|
|
||||||
var whiteboardPath = Script.resolvePath("atp:/whiteboard/wrapper.js");
|
var whiteboardPath = Script.resolvePath("atp:/whiteboard/wrapper.js");
|
||||||
|
|
||||||
var plantPath = Script.resolvePath("atp:/growingPlant/wrapper.js");
|
|
||||||
|
|
||||||
var cuckooClockPath = Script.resolvePath("atp:/cuckooClock/wrapper.js");
|
var cuckooClockPath = Script.resolvePath("atp:/cuckooClock/wrapper.js");
|
||||||
|
|
||||||
var pingPongGunPath = Script.resolvePath("atp:/pingPongGun/wrapper.js");
|
var pingPongGunPath = Script.resolvePath("atp:/pingPongGun/wrapper.js");
|
||||||
|
|
||||||
var musicBoxPath = Script.resolvePath("musicBox/wrapper.js?" + Math.random());
|
|
||||||
|
|
||||||
var transformerPath = Script.resolvePath("atp:/dressingRoom/wrapper.js");
|
var transformerPath = Script.resolvePath("atp:/dressingRoom/wrapper.js");
|
||||||
|
|
||||||
Script.include(utilsPath);
|
Script.include(utilsPath);
|
||||||
|
@ -54,10 +50,8 @@
|
||||||
Script.include(fishTankPath);
|
Script.include(fishTankPath);
|
||||||
Script.include(tiltMazePath);
|
Script.include(tiltMazePath);
|
||||||
Script.include(whiteboardPath);
|
Script.include(whiteboardPath);
|
||||||
Script.include(plantPath);
|
|
||||||
Script.include(cuckooClockPath);
|
Script.include(cuckooClockPath);
|
||||||
Script.include(pingPongGunPath);
|
Script.include(pingPongGunPath);
|
||||||
// Script.include(musicBoxPath);
|
|
||||||
Script.include(transformerPath);
|
Script.include(transformerPath);
|
||||||
|
|
||||||
var TRANSFORMER_URL_ROBOT = 'atp:/dressingRoom/simple_robot.fbx';
|
var TRANSFORMER_URL_ROBOT = 'atp:/dressingRoom/simple_robot.fbx';
|
||||||
|
@ -204,23 +198,13 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
var whiteboard = new Whiteboard({
|
var whiteboard = new Whiteboard({
|
||||||
x: 1104,
|
x: 1105.0955,
|
||||||
y: 460.5,
|
y: 460.5000,
|
||||||
z: -77
|
z: -77.4409
|
||||||
}, {
|
}, {
|
||||||
x: 0,
|
x: -0.0013,
|
||||||
y: -133,
|
y: -133.0056,
|
||||||
z: 0
|
z: -0.0013
|
||||||
});
|
|
||||||
|
|
||||||
var myPlant = new Plant({
|
|
||||||
x: 1099.8785,
|
|
||||||
y: 460.3115,
|
|
||||||
z: -84.7736
|
|
||||||
}, {
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
z: 0
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var pingPongGun = new HomePingPongGun({
|
var pingPongGun = new HomePingPongGun({
|
||||||
|
@ -234,16 +218,15 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
var cuckooClock = new MyCuckooClock({
|
var cuckooClock = new MyCuckooClock({
|
||||||
x: 1105.267,
|
x: 1105.5237,
|
||||||
y: 461.44,
|
y: 461.4826,
|
||||||
z: -81.9495
|
z: -81.7524
|
||||||
}, {
|
}, {
|
||||||
x: 0,
|
x: -0.0013,
|
||||||
y: -57,
|
y: -57.0089,
|
||||||
z: 0
|
z: -0.0013
|
||||||
});
|
});
|
||||||
|
|
||||||
// var musicBox = new MusicBox();
|
|
||||||
print('HOME after creating scripted entities')
|
print('HOME after creating scripted entities')
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue