adding chapters

This commit is contained in:
ericrius1 2016-03-01 12:43:06 -08:00
parent 4d27d5c9f2
commit bc7d7a3dae
4 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,21 @@
// Chapter 1: fireworksLaunchButtonEntityScript.js
(function() {
Script.include("../../libraries/utils.js");
var _this;
Fireworks = function() {
_this = this;
};
Fireworks.prototype = {
preload: function(entityID) {
_this.entityID = entityID;
}
};
// entity scripts always need to return a newly constructed object of our type
return new Fireworks();
});

View file

@ -0,0 +1,30 @@
// Chapter1 : fireworksLaumchButtonSpawner.js
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)));
var SCRIPT_URL = Script.resolvePath("fireworksLaunchButtonEntityScript.js");
var MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/Launch-Button.fbx";
var launchButton = Entities.addEntity({
type: "Model",
name: "hifi-launch-button",
modelURL: MODEL_URL,
position: center,
dimensions: {
x: 0.98,
y: 1.16,
z: 0.98
},
script: SCRIPT_URL,
})
function cleanup() {
Entities.deleteEntity(launchButton);
}
Script.scriptEnding.connect(cleanup);

View file

@ -0,0 +1,21 @@
// Chapter 1: fireworksLaunchButtonEntityScript.js
(function() {
Script.include("../../libraries/utils.js");
var _this;
Fireworks = function() {
_this = this;
};
Fireworks.prototype = {
preload: function(entityID) {
_this.entityID = entityID;
}
};
// entity scripts always need to return a newly constructed object of our type
return new Fireworks();
});

View file

@ -0,0 +1,30 @@
// Chapter1 : fireworksLaumchButtonSpawner.js
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)));
var SCRIPT_URL = Script.resolvePath("fireworksLaunchButtonEntityScript.js");
var MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/Launch-Button.fbx";
var launchButton = Entities.addEntity({
type: "Model",
name: "hifi-launch-button",
modelURL: MODEL_URL,
position: center,
dimensions: {
x: 0.98,
y: 1.16,
z: 0.98
},
script: SCRIPT_URL,
})
function cleanup() {
Entities.deleteEntity(launchButton);
}
Script.scriptEnding.connect(cleanup);