From fc68b31b712f0506e3f6b4e6eb225f3153350f1b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 12 Sep 2015 08:23:50 -0700 Subject: [PATCH 1/6] Revert "Revert "edit.js adjustment"" --- examples/edit.js | 7 ++----- examples/libraries/entityList.js | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index d778ff324d..55b745a4e1 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -260,7 +260,6 @@ var toolBar = (function () { cameraManager.disable(); } else { hasShownPropertiesTool = false; - cameraManager.enable(); entityListTool.setVisible(true); gridTool.setVisible(true); grid.setEnabled(true); @@ -670,15 +669,11 @@ function mouseMove(event) { lastMousePosition = { x: event.x, y: event.y }; - highlightEntityUnderCursor(lastMousePosition, false); idleMouseTimerId = Script.setTimeout(handleIdleMouse, IDLE_MOUSE_TIMEOUT); } function handleIdleMouse() { idleMouseTimerId = null; - if (isActive) { - highlightEntityUnderCursor(lastMousePosition, true); - } } function highlightEntityUnderCursor(position, accurateRay) { @@ -802,6 +797,7 @@ function mouseClickEvent(event) { selectionDisplay.select(selectedEntityID, event); if (Menu.isOptionChecked(MENU_AUTO_FOCUS_ON_SELECT)) { + cameraManager.enable(); cameraManager.focus(selectionManager.worldPosition, selectionManager.worldDimensions, Menu.isOptionChecked(MENU_EASE_ON_FOCUS)); @@ -1142,6 +1138,7 @@ Controller.keyReleaseEvent.connect(function (event) { } else if (event.text == "f") { if (isActive) { if (selectionManager.hasSelection()) { + cameraManager.enable(); cameraManager.focus(selectionManager.worldPosition, selectionManager.worldDimensions, Menu.isOptionChecked(MENU_EASE_ON_FOCUS)); diff --git a/examples/libraries/entityList.js b/examples/libraries/entityList.js index 66dc9f336f..3d6bf4d14f 100644 --- a/examples/libraries/entityList.js +++ b/examples/libraries/entityList.js @@ -49,7 +49,7 @@ EntityListTool = function(opts) { var selectedIDs = []; for (var i = 0; i < selectionManager.selections.length; i++) { - selectedIDs.push(selectionManager.selections[i].id); // ? + selectedIDs.push(selectionManager.selections[i].id); } var data = { @@ -70,6 +70,7 @@ EntityListTool = function(opts) { } selectionManager.setSelections(entityIDs); if (data.focus) { + cameraManager.enable(); cameraManager.focus(selectionManager.worldPosition, selectionManager.worldDimensions, Menu.isOptionChecked(MENU_EASE_ON_FOCUS)); From ef7e908675e7fdaebc6e73d8aec2f1468e217f6e Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 30 Sep 2015 18:03:15 -0700 Subject: [PATCH 2/6] allow dynamic objects to be set collisionless --- libraries/entities/src/BoxEntityItem.h | 1 + libraries/entities/src/EntityItem.h | 2 +- libraries/entities/src/SphereEntityItem.h | 1 + libraries/physics/src/EntityMotionState.cpp | 6 ++++++ libraries/physics/src/ObjectMotionState.h | 8 ++++---- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/BoxEntityItem.h b/libraries/entities/src/BoxEntityItem.h index fdc66dd3e5..cc3bba4823 100644 --- a/libraries/entities/src/BoxEntityItem.h +++ b/libraries/entities/src/BoxEntityItem.h @@ -52,6 +52,7 @@ public: } virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; } + virtual bool shouldBePhysical() const { return true; } virtual void debugDump() const; diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index 62b436b498..f070e2c1e4 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -334,7 +334,7 @@ public: bool getCollisionsWillMove() const { return _collisionsWillMove; } void setCollisionsWillMove(bool value) { _collisionsWillMove = value; } - virtual bool shouldBePhysical() const { return !_ignoreForCollisions; } + virtual bool shouldBePhysical() const { return false; } bool getLocked() const { return _locked; } void setLocked(bool value) { _locked = value; } diff --git a/libraries/entities/src/SphereEntityItem.h b/libraries/entities/src/SphereEntityItem.h index 19ea5d06f9..81a6cf704c 100644 --- a/libraries/entities/src/SphereEntityItem.h +++ b/libraries/entities/src/SphereEntityItem.h @@ -51,6 +51,7 @@ public: } virtual ShapeType getShapeType() const { return SHAPE_TYPE_SPHERE; } + virtual bool shouldBePhysical() const { return true; } virtual bool supportsDetailedRayIntersection() const { return true; } virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index ff546dbb0b..9cbe89dda6 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -596,6 +596,12 @@ QString EntityMotionState::getName() { // virtual int16_t EntityMotionState::computeCollisionGroup() { + if (!_entity) { + return COLLISION_GROUP_STATIC; + } + if (_entity->getIgnoreForCollisions()) { + return COLLISION_GROUP_COLLISIONLESS; + } switch (computeObjectMotionType()){ case MOTION_TYPE_STATIC: return COLLISION_GROUP_STATIC; diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index 1bdf8b6372..61254e49bd 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -37,11 +37,11 @@ enum MotionStateType { // The update flags trigger two varieties of updates: "hard" which require the body to be pulled // and re-added to the physics engine and "easy" which just updates the body properties. -const uint32_t HARD_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_MOTION_TYPE | EntityItem::DIRTY_SHAPE); +const uint32_t HARD_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_MOTION_TYPE | EntityItem::DIRTY_SHAPE | + EntityItem::DIRTY_COLLISION_GROUP); const uint32_t EASY_DIRTY_PHYSICS_FLAGS = (uint32_t)(EntityItem::DIRTY_TRANSFORM | EntityItem::DIRTY_VELOCITIES | - EntityItem::DIRTY_MASS | EntityItem::DIRTY_COLLISION_GROUP | - EntityItem::DIRTY_MATERIAL | EntityItem::DIRTY_SIMULATOR_ID | - EntityItem::DIRTY_SIMULATOR_OWNERSHIP); + EntityItem::DIRTY_MASS | EntityItem::DIRTY_MATERIAL | + EntityItem::DIRTY_SIMULATOR_ID | EntityItem::DIRTY_SIMULATOR_OWNERSHIP); // These are the set of incoming flags that the PhysicsEngine needs to hear about: const uint32_t DIRTY_PHYSICS_FLAGS = (uint32_t)(HARD_DIRTY_PHYSICS_FLAGS | EASY_DIRTY_PHYSICS_FLAGS | From 22b66077604e699d1725cc4c44e1a9594993b080 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 30 Sep 2015 18:15:34 -0700 Subject: [PATCH 3/6] add polyvox entities to physics engine --- libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h index e1e042f3d0..ef44ba5ab0 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h @@ -79,6 +79,7 @@ public: glm::mat4 localToVoxelMatrix() const; virtual ShapeType getShapeType() const; + virtual bool shouldBePhysical() const { return true; } virtual bool isReadyToComputeShape(); virtual void computeShapeInfo(ShapeInfo& info); From 381c98c4fa268b09ec81c85d38ad4a8676a58db0 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 30 Sep 2015 18:32:08 -0700 Subject: [PATCH 4/6] fix for ModelEntityItem::shouldBePhysical() --- libraries/entities/src/ModelEntityItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 70747937d8..cd9e3cd3e1 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -457,5 +457,5 @@ QString ModelEntityItem::getAnimationSettings() const { // virtual bool ModelEntityItem::shouldBePhysical() const { - return EntityItem::shouldBePhysical() && getShapeType() != SHAPE_TYPE_NONE; + return getShapeType() != SHAPE_TYPE_NONE; } From 2fbb436bc55b50ee3d12d2ccebab01912f0446fd Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 1 Oct 2015 12:42:23 -0700 Subject: [PATCH 5/6] Fix Reload Content menu item --- interface/src/Application.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2a8f7cf8b5..e386cd3a81 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2741,12 +2741,19 @@ void Application::cameraMenuChanged() { } void Application::reloadResourceCaches() { + // Clear entities out of view frustum + _viewFrustum.setPosition(glm::vec3(0.0f, 0.0f, TREE_SCALE)); + _viewFrustum.setOrientation(glm::quat()); + queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions); + emptyLocalCache(); - + DependencyManager::get()->refreshAll(); DependencyManager::get()->refreshAll(); DependencyManager::get()->refreshAll(); DependencyManager::get()->refreshAll(); + + DependencyManager::get()->reset(); // Force redownload of .fst models } void Application::rotationModeChanged() { From 0497de47ea41f540d3364955980a089551d46d7e Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 2 Oct 2015 12:40:14 -0700 Subject: [PATCH 6/6] No longer removing non-existent entities from spray paint can; color tweaks to paint stream --- examples/toys/sprayPaintCan.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/examples/toys/sprayPaintCan.js b/examples/toys/sprayPaintCan.js index e0aeb19995..251827ead7 100644 --- a/examples/toys/sprayPaintCan.js +++ b/examples/toys/sprayPaintCan.js @@ -9,7 +9,7 @@ // -(function() { +(function () { // Script.include("../libraries/utils.js"); //Need absolute path for now, for testing before PR merge and s3 cloning. Will change post-merge @@ -33,19 +33,19 @@ var MIN_POINT_DISTANCE = 0.01; var STROKE_WIDTH = 0.02; - this.setRightHand = function() { + this.setRightHand = function () { this.hand = 'RIGHT'; } - this.setLeftHand = function() { + this.setLeftHand = function () { this.hand = 'LEFT'; } - this.startNearGrab = function() { + this.startNearGrab = function () { this.whichHand = this.hand; } - this.toggleWithTriggerPressure = function() { + this.toggleWithTriggerPressure = function () { var handClickString = this.whichHand + "_HAND_CLICK"; var handClick = Controller.findAction(handClickString); @@ -60,7 +60,7 @@ } } - this.enableStream = function() { + this.enableStream = function () { var position = Entities.getEntityProperties(this.entityId, "position").position; var animationSettings = JSON.stringify({ fps: 30, @@ -85,6 +85,11 @@ particleRadius: 0.01, radiusSpread: 0.005, polarFinish: 0.05, + colorStart: { + red: 50, + green: 10, + blue: 150 + }, color: { red: 170, green: 20, @@ -105,11 +110,11 @@ } - this.releaseGrab = function() { + this.releaseGrab = function () { this.disableStream(); } - this.disableStream = function() { + this.disableStream = function () { Entities.deleteEntity(this.paintStream); this.paintStream = null; this.spraying = false; @@ -117,7 +122,7 @@ } - this.continueNearGrab = function() { + this.continueNearGrab = function () { this.toggleWithTriggerPressure(); @@ -143,7 +148,7 @@ }); } - this.preload = function(entityId) { + this.preload = function (entityId) { this.sprayVolume = 0.1; this.spraying = false; this.entityId = entityId; @@ -151,12 +156,9 @@ } - this.unload = function() { + this.unload = function () { if (this.paintStream) { Entities.deleteEntity(this.paintStream); } - this.strokes.forEach(function(stroke) { - Entities.deleteEntity(stroke); - }); } -}); +}); \ No newline at end of file