Skip to content

Instantly share code, notes, and snippets.

@jessherzog
Created October 31, 2016 16:51
Show Gist options
  • Save jessherzog/be1f96106914e5ee33cb3f27492172bf to your computer and use it in GitHub Desktop.
Save jessherzog/be1f96106914e5ee33cb3f27492172bf to your computer and use it in GitHub Desktop.
disassociative walk geo object sample
var Objs = {
loaded: false,
rotating: false,
init: function initFn() {
this.createModelAtLocation();
},
createModelAtLocation: function createModelAtLocationFn() {
/* define locations. relative is for debugging */
// var location = new AR.RelativeLocation(null, 1, 0, 1);
var location_1 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //rat
var location_2 = new AR.GeoLocation(40.72228674, -73.98002654, 5); //bag
var location_3 = new AR.GeoLocation(40.7233964, -73.97946328, 4); //abc
var location_4 = new AR.GeoLocation(40.72361057, -73.97932917, 4); //cig
var location_5 = new AR.GeoLocation(40.72521342, -73.97788815, 3); //cafe
var location_6 = new AR.GeoLocation(40.72724609, -73.97907905, 3); //allday
var location_7 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //flow1
var location_8 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //flow2
var location_9 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //flow3
var location_10 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //flow4
var location_11 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //flow5
var location_12 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //flow6
var location_13 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //flow7
var location_14 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //cake
var location_15 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //web
var location_16 = new AR.GeoLocation(40.72142333, -73.97801375, 4); //gum
/* load models. */
var ratMod = new AR.Model("assets/1_rat.wt3", {
onLoaded: this.objLoaded,
scale: {
x: 1.0,
y: 1.0,
z: 1.0
}
});
var bagMod = new AR.Model("assets/2_bodega_bag.wt3", {
onLoaded: this.objLoaded,
scale: {
x: 1.0,
y: 1.0,
z: 1.0
}
});
var abcMod = new AR.Model("assets/3_letters.wt3", {
onLoaded: this.objLoaded,
scale: {
x: 1.0,
y: 1.0,
z: 1.0
}
});
var cigMod = new AR.Model("assets/4_cig.wt3", {
onLoaded: this.objLoaded,
scale: {
x: 1.0,
y: 1.0,
z: 1.0
}
});
var cafeMod = new AR.Model("assets/5_ninth.wt3", {
onLoaded: this.objLoaded,
scale: {
x: 1.0,
y: 1.0,
z: 1.0
}
});
var alldayMod = new AR.Model("assets/6_allday.wt3", {
onLoaded: this.objLoaded,
scale: {
x: 1.0,
y: 1.0,
z: 1.0
}
});
var indicatorImage = new AR.ImageResource("assets/indi.png");
var indicatorDrawable = new AR.ImageDrawable(indicatorImage, 0.1, {
verticalAnchor: AR.CONST.VERTICAL_ANCHOR.TOP
});
/*
Putting it all together the location and 3D model is added to an AR.GeoObject.
*/
var rat = new AR.GeoObject(location_1, {
drawables: {
cam: [ratMod],
indicator: [indicatorDrawable]
}
});
var bag = new AR.GeoObject(location_2, {
drawables: {
cam: [bagMod],
indicator: [indicatorDrawable]
}
});
var abc = new AR.GeoObject(location_3, {
drawables: {
cam: [abcMod],
indicator: [indicatorDrawable]
}
});
var cig = new AR.GeoObject(location_4, {
drawables: {
cam: [cigMod],
indicator: [indicatorDrawable]
}
});
var cafe = new AR.GeoObject(location_5, {
drawables: {
cam: [cafeMod],
indicator: [indicatorDrawable]
}
});
var allday = new AR.GeoObject(location_6, {
drawables: {
cam: [alldayMod],
indicator: [indicatorDrawable]
}
});
},
objLoaded: function objLoadedFn() {
Objs.loaded = true;
var e = document.getElementById('loadingMessage');
e.parentElement.removeChild(e);
}
};
Objs.init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment