fixed rotation plant

This commit is contained in:
ericrius1 2016-03-23 16:41:57 -07:00
parent c4f36dc02e
commit 7bbb8167d0
2 changed files with 14 additions and 8 deletions

View file

@ -12,14 +12,13 @@
var PLANT_SCRIPT_URL = Script.resolvePath("growingPlantEntityScript.js?v1" + Math.random().toFixed(2)); var PLANT_SCRIPT_URL = Script.resolvePath("growingPlantEntityScript.js?v1" + Math.random().toFixed(2));
var WATER_CAN_SCRIPT_URL = Script.resolvePath("waterCanEntityScript.js?v2" + Math.random().toFixed()); var WATER_CAN_SCRIPT_URL = Script.resolvePath("waterCanEntityScript.js?v2" + Math.random().toFixed());
Plant = function(spawnPosition, spawnRotation) { Plant = function(spawnPosition, spawnRotation) {
var orientation = Camera.getOrientation(); var orientation;
orientation = Quat.safeEulerAngles(orientation);
orientation.x = 0;
orientation = Quat.fromVec3Degrees(orientation);
if (spawnRotation !== undefined) { if (spawnRotation !== undefined) {
orientation = spawnRotation; orientation = Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z);
} else {
orientation = Camera.getOrientation();
} }
print("EBL ORIENTATION " + JSON.stringify(orientation));
var bowlPosition = spawnPosition; var bowlPosition = spawnPosition;
var BOWL_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Bowl.fbx"; var BOWL_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Bowl.fbx";
var bowlDimensions = { var bowlDimensions = {
@ -128,6 +127,13 @@ Plant = function(spawnPosition, spawnRotation) {
var waterSpoutPosition = Vec3.sum(waterCanPosition, Vec3.multiply(0.2, Quat.getFront(orientation))) var waterSpoutPosition = Vec3.sum(waterCanPosition, Vec3.multiply(0.2, Quat.getFront(orientation)))
var waterSpoutRotation = Quat.multiply(waterCanRotation, Quat.fromPitchYawRollDegrees(10, 0, 0)); var waterSpoutRotation = Quat.multiply(waterCanRotation, Quat.fromPitchYawRollDegrees(10, 0, 0));
// var waterSpoutRotation = {
// x: waterSpoutRotation.x,
// y: waterSpoutRotation.y,
// z: waterSpoutRotation.z,
// w: waterSpoutRotation.w
// };
print("EBL SET ROTATION")
var waterSpout = Entities.addEntity({ var waterSpout = Entities.addEntity({
type: "Box", type: "Box",
name: "hifi-water-spout", name: "hifi-water-spout",
@ -144,7 +150,7 @@ Plant = function(spawnPosition, spawnRotation) {
position: waterSpoutPosition, position: waterSpoutPosition,
rotation: waterSpoutRotation, rotation: waterSpoutRotation,
parentID: waterCan, parentID: waterCan,
visible: false, // visible: false,
userData: JSON.stringify({ userData: JSON.stringify({
'hifiHomeKey': { 'hifiHomeKey': {
'reset': true 'reset': true

View file

@ -89,7 +89,7 @@
_this.showTidyingButton(); _this.showTidyingButton();
_this.playTidyingSound(); _this.playTidyingSound();
// _this.findAndDeleteHomeEntities(); _this.findAndDeleteHomeEntities();
Script.setTimeout(function() { Script.setTimeout(function() {
_this.showTidyButton(); _this.showTidyButton();
_this.tidying = false; _this.tidying = false;