This commit is contained in:
ericrius1 2016-03-21 16:45:23 -07:00
parent 51508b467c
commit efd56ac22a
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,23 @@
(function() {
var _this;
MyEntity = function() {
_this = this;
};
MyEntity.prototype = {
preload: function(entityID) {
this.entityID = entityID;
print("EBL PRELOAD ENTITY SCRIPT!!!")
},
};
// entity scripts always need to return a newly constructed object of our type
return new MyEntity();
});

View file

@ -0,0 +1,31 @@
var orientation = Camera.getOrientation();
orientation = Quat.safeEulerAngles(orientation);
orientation.x = 0;
orientation = Quat.fromVec3Degrees(orientation);
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(orientation)));
// Math.random ensures no caching of script
var SCRIPT_URL = Script.resolvePath("myEntityScript.js?v1" + Math.random())
var myEntity = Entities.addEntity({
type: "Sphere",
color: {
red: 200,
green: 10,
blue: 200
},
position: center,
dimensions: {
x: 1,
y: 1,
z: 1
},
script: SCRIPT_URL
})
function cleanup() {
// Entities.deleteEntity(myEntity);
}
Script.scriptEnding.connect(cleanup);