Skip to content

Instantly share code, notes, and snippets.

View SamGondelman's full-sized avatar

Sam Gondelman SamGondelman

  • Blimp Development, LLC
View GitHub Profile
(function(){
var id;
this.preload = function(entityID) {
id = entityID;
};
this.enterEntity = function(entityID) {
Window.location = "hifi://eschatology/1000,1000,1000";
};
(function(){
var id;
this.preload = function(entityID) {
id = entityID;
};
this.enterEntity = function(entityID) {
print("enterEntity() called on " + id);
};
{
"Entities": [
{
"type": "Material",
"position" : {
"x": 0,
"y": 0,
"z": 1
},
"materialData": "{\n \"materials\": {\n \"emissiveMap\": \"http://cdn1-www.dogtime.com/assets/uploads/2011/03/puppy-development.jpg\",\n \"albedoMap\": \"http://cdn1-www.dogtime.com/assets/uploads/2011/03/puppy-development.jpg\",\n \"opacityMap\": \"https://supermariorun.com/assets/img/stage/mario03.png\",\n \"metallicMap\": \"https://www.filterforge.com/filters/14196-metallic.jpg\",\n \"roughnessMap\": \"https://artisaverb.info/Cerberus/Cerberus_R.jpg\",\n \"normalMap\": \"http://jsoverson.github.io/texture.js/demo/images/brickwork-normal.jpg\",\n \"occlusionMap\": \"https://www.filterforge.com/filters/10500-ambientocclusion.jpg\",\n \"scatteringMap\": \"https://hifi-public.s3.amazonaws.com/sam/models/skinRenderingTest/priscilla/skin_map.jpg\"\n }\n}"
{
"Entities": [
{
"type": "Model",
"dimensions": {
"x": 1,
"y": 1,
"z": 1
},
"position" : {
(function() { // BEGIN LOCAL_SCOPE
var entities = [];
function getPos(x, y, z) {
return Vec3.sum(MyAvatar.position, Vec3.sum(Vec3.multiply(x, Quat.getRight(MyAvatar.orientation)),
Vec3.sum(Vec3.multiply(y, Quat.getUp(MyAvatar.orientation)),
Vec3.multiply(z + 6, Quat.getForward(MyAvatar.orientation)))));
}
(function() { // BEGIN LOCAL_SCOPE
var entities = [];
function getPos(x, y) {
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(6, Quat.getFront(MyAvatar.orientation)));
return Vec3.sum(Vec3.sum(center, Vec3.multiply(Quat.getRight(MyAvatar.orientation), x)), Vec3.multiply(Quat.getUp(MyAvatar.orientation), y));
}
entities.push(Entities.addEntity({
(function() { // BEGIN LOCAL_SCOPE
//var sound = SoundCache.getSound("http://hifi-content.s3.amazonaws.com/ken/test/WaveFormatExtensible.wav");
var sound = SoundCache.getSound("http://hifi-public.s3.amazonaws.com/birarda/medium-crowd.wav");
var injector = undefined;
var localOnly = true;
var pitch = 1.0;
var loop = true;
(function() { // BEGIN LOCAL_SCOPE
var entities = [];
entities.push(Entities.addEntity({
type: "Model",
modelURL: "http://mpassets.highfidelity.com/ad348528-de38-420c-82bb-054cb22163f5-v1/mannequin.fst",
position: Vec3.sum(MyAvatar.position, Vec3.multiply(4.0, Quat.getForward(MyAvatar.orientation))),
rotation: MyAvatar.orientation,
animation: {
(function() { // BEGIN LOCAL_SCOPE
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: Script.resolvePath('laser.svg'),
activeIcon: Script.resolvePath('laser-a.svg'),
text: "TEST"
});
var overlay = Overlays.addOverlay("text", {
(function() { // BEGIN LOCAL_SCOPE
function getTopMaterial(multiMaterial) {
// For non-models: multiMaterial[0] will be the top material
// For models, multiMaterial[0] is the base material, and multiMaterial[1] is the highest priority applied material
if (multiMaterial.length > 1) {
if (multiMaterial[1].priority > multiMaterial[0].priority) {
return multiMaterial[1];
}
}