mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 18:23:22 +02:00
removed vr vj stuff
This commit is contained in:
parent
9e25009734
commit
cc92294d16
3 changed files with 0 additions and 142 deletions
|
@ -1,35 +0,0 @@
|
|||
|
||||
(function() {
|
||||
var _this;
|
||||
Script.include("../libraries/utils.js");
|
||||
VRVJSoundEntity = function() {
|
||||
_this = this;
|
||||
|
||||
};
|
||||
|
||||
VRVJSoundEntity.prototype = {
|
||||
playSound: function() {
|
||||
// _this.soundInjector = Audio.playSound(_this.clip, {position: _this.position, volume: 1.0});
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
_this.entityID = entityID;
|
||||
_this.position = Entities.getEntityProperties(_this.entityID, "position").position;
|
||||
_this.userData = getEntityUserData(_this.entityID);
|
||||
_this.clip = SoundCache.getSound(_this.userData.soundURL);
|
||||
|
||||
},
|
||||
|
||||
unload: function() {
|
||||
if (_this.soundInjector) {
|
||||
_this.soundInjector.stop();
|
||||
delete _this.soundInjector;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
// entity scripts always need to return a newly constructed object of our type
|
||||
return new VRVJSoundEntity();
|
||||
});
|
|
@ -1,58 +0,0 @@
|
|||
(function() {
|
||||
var _this;
|
||||
Script.include("../libraries/utils.js");
|
||||
var NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
|
||||
var ZERO_VEC = {x: 0, y: 0, z: 0};
|
||||
VRVJVisualEntity = function() {
|
||||
_this = this;
|
||||
_this.SOUND_LOOP_NAME = "VRVJ-Sound-Cartridge";
|
||||
_this.SOUND_CARTRIDGE_SEARCH_RANGE = 0.1;
|
||||
|
||||
};
|
||||
|
||||
VRVJVisualEntity.prototype = {
|
||||
|
||||
releaseGrab: function() {
|
||||
print("RELEASE GRAB")
|
||||
// search for nearby sound loop entities and if found, add it as a parent
|
||||
Script.setTimeout(function() {
|
||||
_this.searchForNearbySoundLoops();
|
||||
}, 100);
|
||||
},
|
||||
|
||||
searchForNearbySoundLoops: function() {
|
||||
_this.position = Entities.getEntityProperties(_this.entityID, "position").position;
|
||||
var entities = Entities.findEntities(_this.position, _this.SOUND_CARTRIDGE_SEARCH_RANGE);
|
||||
for (var i = 0; i < entities.length; i++) {
|
||||
var entity = entities[i];
|
||||
var props = Entities.getEntityProperties(entity, ["name", "color"]);
|
||||
if (props.name.indexOf(_this.SOUND_LOOP_NAME) !== -1) {
|
||||
// Need to set a timeout to wait for grab script to stop messing with entity
|
||||
Entities.editEntity(_this.entityID, {
|
||||
parentID: entity,
|
||||
dynamic: false
|
||||
});
|
||||
Script.setTimeout(function() {
|
||||
Entities.editEntity(_this.entityID, {dynamic: true, velocity: ZERO_VEC, color: props.color});
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
Entities.editEntity(_this.entityID, {
|
||||
parentID: NULL_UUID,
|
||||
color: _this.originalColor
|
||||
});
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
print("YAAAA")
|
||||
_this.entityID = entityID;
|
||||
_this.originalColor = Entities.getEntityProperties(_this.entityID, "color").color;
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
// entity scripts always need to return a newly constructed object of our type
|
||||
return new VRVJVisualEntity();
|
||||
});
|
|
@ -1,49 +0,0 @@
|
|||
var orientation = MyAvatar.orientation;
|
||||
orientation = Quat.safeEulerAngles(orientation);
|
||||
orientation.x = 0;
|
||||
orientation = Quat.fromVec3Degrees(orientation);
|
||||
var center = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(2, Quat.getFront(orientation)));
|
||||
|
||||
|
||||
Script.include("../libraries/utils.js");
|
||||
|
||||
var SOUND_SCRIPT_URL = Script.resolvePath("VRVJSoundCartridgeEntityScript.js");
|
||||
var SOUND_CARTRIDGE_NAME = "VRVJ-Sound-Cartridge";
|
||||
var soundEntity = Entities.addEntity({
|
||||
type: "Box",
|
||||
name: SOUND_CARTRIDGE_NAME,
|
||||
dimensions: {x: 0.1, y: 0.1, z: 0.1},
|
||||
color: {red: 200, green: 10, blue: 200},
|
||||
position: center,
|
||||
damping: 1,
|
||||
angularDamping: 1,
|
||||
dynamic: true,
|
||||
script: SOUND_SCRIPT_URL,
|
||||
userData: JSON.stringify({
|
||||
soundURL: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/VRVJ/Synth-MarchToWar.wav",
|
||||
})
|
||||
});
|
||||
|
||||
var VISUAL_SCRIPT_URL = Script.resolvePath("VRVJVisualCartridgeEntityScript.js?v1" + Math.random());
|
||||
var visualEntity = Entities.addEntity({
|
||||
type: "Sphere",
|
||||
name: "VRVJ-Visual-Cartridge",
|
||||
dimensions: {x: 0.1, y: 0.1, z: 0.1},
|
||||
damping: 1,
|
||||
angularDamping: 1,
|
||||
color: {red: 0, green: 200, blue: 10},
|
||||
dynamic: true,
|
||||
position: Vec3.subtract(center, {x: 0, y: 0.2, z: 0}),
|
||||
script: VISUAL_SCRIPT_URL
|
||||
});
|
||||
Script.setTimeout(function() {
|
||||
// Wait for sounds to load
|
||||
Entities.callEntityMethod(soundEntity, "playSound");
|
||||
}, 1000)
|
||||
|
||||
function cleanup() {
|
||||
Entities.deleteEntity(soundEntity);
|
||||
Entities.deleteEntity(visualEntity);
|
||||
}
|
||||
|
||||
Script.scriptEnding.connect(cleanup);
|
Loading…
Reference in a new issue