mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 12:15:13 +02:00
changed to water spout entity script
This commit is contained in:
parent
2cd8e088f5
commit
00dcddd838
2 changed files with 22 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
Loading…
Reference in a new issue