From 1ef01d670dd1d84c3f96d4241096d9b23a147c03 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 25 Jan 2016 18:07:14 -0800 Subject: [PATCH 1/3] Revert "Make entity properties be undefined after entity is unloaded" --- examples/libraries/entitySelectionTool.js | 1 + .../entities/src/EntityItemProperties.cpp | 22 +++++++++++---- libraries/entities/src/EntityItemProperties.h | 28 ++++++++----------- .../entities/src/EntityScriptingInterface.cpp | 4 +-- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index c1675ef044..94ffb48a71 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -1515,6 +1515,7 @@ SelectionDisplay = (function() { } that.updateRotationHandles(); + that.highlightSelectable(); var rotation, dimensions, position, registrationPoint; diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 3d67d32ea8..0ccd6a74bd 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -32,7 +32,22 @@ KeyLightPropertyGroup EntityItemProperties::_staticKeyLight; EntityPropertyList PROP_LAST_ITEM = (EntityPropertyList)(PROP_AFTER_LAST_ITEM - 1); EntityItemProperties::EntityItemProperties(EntityPropertyFlags desiredProperties) : - _desiredProperties(desiredProperties) //, + +_id(UNKNOWN_ENTITY_ID), +_idSet(false), +_lastEdited(0), +_type(EntityTypes::Unknown), + +_glowLevel(0.0f), +_localRenderAlpha(1.0f), + +_glowLevelChanged(false), +_localRenderAlphaChanged(false), + +_defaultSettings(true), +_naturalDimensions(1.0f, 1.0f, 1.0f), +_naturalPosition(0.0f, 0.0f, 0.0f), +_desiredProperties(desiredProperties) { } @@ -306,11 +321,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool QScriptValue properties = engine->newObject(); EntityItemProperties defaultEntityProperties; - if (!_entityFound) { - // Return without setting any default property values so that properties are reported in JavaScript as undefined. - return properties; - } - if (_idSet) { COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(id, _id.toString()); } diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index f66d17eae2..ff288fbe95 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -272,36 +272,32 @@ public: void setJointRotationsDirty() { _jointRotationsSetChanged = true; _jointRotationsChanged = true; } void setJointTranslationsDirty() { _jointTranslationsSetChanged = true; _jointTranslationsChanged = true; } - void setEntityFound() { _entityFound = true; } - protected: QString getCollisionMaskAsString() const; void setCollisionMaskFromString(const QString& maskString); private: - QUuid _id { UNKNOWN_ENTITY_ID }; - bool _idSet { false }; - quint64 _lastEdited { 0 }; - EntityTypes::EntityType _type { EntityTypes::Unknown }; + QUuid _id; + bool _idSet; + quint64 _lastEdited; + EntityTypes::EntityType _type; void setType(const QString& typeName) { _type = EntityTypes::getEntityTypeFromName(typeName); } - float _glowLevel { 0.0f }; - float _localRenderAlpha { 1.0f }; - bool _glowLevelChanged { false }; - bool _localRenderAlphaChanged { false }; - bool _defaultSettings { true }; - bool _dimensionsInitialized { true }; // Only false if creating an entity locally with no dimensions properties + float _glowLevel; + float _localRenderAlpha; + bool _glowLevelChanged; + bool _localRenderAlphaChanged; + bool _defaultSettings; + bool _dimensionsInitialized = true; // Only false if creating an entity localy with no dimensions properties // NOTE: The following are pseudo client only properties. They are only used in clients which can access // properties of model geometry. But these properties are not serialized like other properties. QVector _sittingPoints; QStringList _textureNames; - glm::vec3 _naturalDimensions { 1.0f, 1.0f, 1.0f }; - glm::vec3 _naturalPosition { 0.0f, 0.0f, 0.0f }; + glm::vec3 _naturalDimensions; + glm::vec3 _naturalPosition; EntityPropertyFlags _desiredProperties; // if set will narrow scopes of copy/to/from to just these properties - - bool _entityFound { false }; }; Q_DECLARE_METATYPE(EntityItemProperties); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 5bee9ac3d8..8fd7be912e 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -202,13 +202,11 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit } } - results = convertLocationToScriptSemantics(results); - results.setEntityFound(); } }); } - return results; + return convertLocationToScriptSemantics(results); } QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) { From bc9621baabdce000adb77181cd22c45b13fd670c Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 25 Jan 2016 21:54:35 -0800 Subject: [PATCH 2/3] CharacterController: Improve ground support detection In addition to the existing line probe ground check, also check if the bottom sphere of the capsule is contact with any geometry before going into hover mode. This should prevent going into the fly animation when standing or walking on collision shapes with small gaps between elements. --- libraries/physics/src/CharacterController.cpp | 29 +++++++++++++++++-- libraries/physics/src/CharacterController.h | 2 ++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libraries/physics/src/CharacterController.cpp b/libraries/physics/src/CharacterController.cpp index 432b89ba31..65432e2f65 100644 --- a/libraries/physics/src/CharacterController.cpp +++ b/libraries/physics/src/CharacterController.cpp @@ -60,6 +60,7 @@ CharacterController::CharacterController() { _followTime = 0.0f; _followLinearDisplacement = btVector3(0, 0, 0); _followAngularDisplacement = btQuaternion::getIdentity(); + _hasSupport = false; _pendingFlags = PENDING_FLAG_UPDATE_SHAPE; @@ -106,6 +107,28 @@ void CharacterController::setDynamicsWorld(btDynamicsWorld* world) { } } +bool CharacterController::checkForSupport(btCollisionWorld* collisionWorld) const { + int numManifolds = collisionWorld->getDispatcher()->getNumManifolds(); + for (int i = 0; i < numManifolds; i++) { + btPersistentManifold* contactManifold = collisionWorld->getDispatcher()->getManifoldByIndexInternal(i); + const btCollisionObject* obA = static_cast(contactManifold->getBody0()); + const btCollisionObject* obB = static_cast(contactManifold->getBody1()); + if (obA == _rigidBody || obB == _rigidBody) { + int numContacts = contactManifold->getNumContacts(); + for (int j = 0; j < numContacts; j++) { + btManifoldPoint& pt = contactManifold->getContactPoint(j); + + // check to see if contact point is touching the bottom sphere of the capsule. + float contactPointY = (obA == _rigidBody) ? pt.m_localPointA.getY() : pt.m_localPointB.getY(); + if (contactPointY < -_halfHeight) { + return true; + } + } + } + } + return false; +} + void CharacterController::preStep(btCollisionWorld* collisionWorld) { // trace a ray straight down to see if we're standing on the ground const btTransform& xform = _rigidBody->getWorldTransform(); @@ -125,6 +148,8 @@ void CharacterController::preStep(btCollisionWorld* collisionWorld) { if (rayCallback.hasHit()) { _floorDistance = rayLength * rayCallback.m_closestHitFraction - _radius; } + + _hasSupport = checkForSupport(collisionWorld); } void CharacterController::playerStep(btCollisionWorld* dynaWorld, btScalar dt) { @@ -248,7 +273,7 @@ void CharacterController::jump() { bool CharacterController::onGround() const { const btScalar FLOOR_PROXIMITY_THRESHOLD = 0.3f * _radius; - return _floorDistance < FLOOR_PROXIMITY_THRESHOLD; + return _floorDistance < FLOOR_PROXIMITY_THRESHOLD || _hasSupport; } void CharacterController::setHovering(bool hover) { @@ -400,7 +425,7 @@ void CharacterController::preSimulation() { if (_floorDistance < JUMP_PROXIMITY_THRESHOLD) { _isJumping = false; } - } else { + } else if (!_hasSupport) { _floorDistance = FLT_MAX; setHovering(true); } diff --git a/libraries/physics/src/CharacterController.h b/libraries/physics/src/CharacterController.h index a32425e3e7..224632ea6b 100644 --- a/libraries/physics/src/CharacterController.h +++ b/libraries/physics/src/CharacterController.h @@ -86,6 +86,7 @@ public: protected: void updateUpAxis(const glm::quat& rotation); + bool checkForSupport(btCollisionWorld* collisionWorld) const; protected: btVector3 _currentUp; @@ -104,6 +105,7 @@ protected: btScalar _radius; btScalar _floorDistance; + bool _hasSupport; btScalar _gravity; From 1f44222ed26f2fce907231c44f0d20a7bdeb68e1 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 25 Jan 2016 16:38:46 -0800 Subject: [PATCH 3/3] Change server exit popup wording --- server-console/src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index 767f426608..d6cde89d09 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -110,8 +110,8 @@ function shutdown() { dialog.showMessageBox({ type: 'question', buttons: ['Yes', 'No'], - title: 'Are you sure?', - message: 'Quitting will stop your Server Console and your Home domain will no longer be running.' + title: 'Stopping Server Console', + message: 'Quitting will stop your Server Console and your Home domain will no longer be running.\nDo you wish to continue?' }, shutdownCallback); } else { shutdownCallback(0);