changed to water spout entity script

This commit is contained in:
ericrius1 2016-02-29 11:44:33 -08:00
parent 2cd8e088f5
commit 00dcddd838
2 changed files with 22 additions and 5 deletions

View file

@ -44,6 +44,7 @@ var plant = Entities.addEntity({
var WATER_CAN_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/waterCan.fbx";
var WATER_CAN_SCRIPT_URL = Script.resolvePath("waterCanEntityScript.js?v2" + Math.random());
var waterCanPosition = Vec3.sum(plantPosition, Vec3.multiply(0.6, Quat.getRight(orientation)));
var waterCanRotation = orientation;
var waterCan = Entities.addEntity({
type: "Model",
shapeType: 'box',
@ -53,13 +54,26 @@ var waterCan = Entities.addEntity({
position: waterCanPosition,
angularDamping: 1,
damping: 1,
dynamic: true
dynamic: true,
rotation: waterCanRotation
});
var waterSpoutPosition = Vec3.sum(waterCanPosition, Vec3.multiply(0.2, Quat.getFront(orientation)))
var waterSpout = Entities.addEntity({
type: "Box",
dimensions: {x: 0.02, y: 0.02, z: 0.07},
color: {red: 200, green: 10, blue: 200},
position: waterSpoutPosition,
rotation: waterCanRotation,
parentID: waterCan
});
function cleanup() {
Entities.deleteEntity(plant);
Entities.deleteEntity(bowl);
Entities.deleteEntity(waterCan);
Entities.deleteEntity(waterSpout);
}

View file

@ -1,5 +1,5 @@
//
// waterCanEntityScript.js
// waterSpoutEntityScript.js
// examples/homeContent/plant
//
// Created by Eric Levin on 2/15/16.
@ -15,7 +15,7 @@
Script.include("../../libraries/utils.js");
var _this;
WaterCan = function() {
WaterSpout = function() {
_this = this;
_this.waterSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/shower.wav");
_this.POUR_ANGLE_THRESHOLD = -30;
@ -23,7 +23,10 @@
};
WaterCan.prototype = {
WaterSpout.prototype = {
continueEquip: function() {
_this.continueHolding();
},
continueNearGrab: function() {
_this.continueHolding();
@ -115,5 +118,5 @@
};
// entity scripts always need to return a newly constructed object of our type
return new WaterCan();
return new WaterSpout();
});