From 867fe184724c6b98ff61a81b5d23069a5784bc5e Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 7 May 2015 10:11:36 -0700 Subject: [PATCH] put some code back now that entity-server is doing simple simulation again. don't draw blue physics-enabled dot unless debug menu-item is checked --- .../src/RenderableDebugableEntityItem.cpp | 21 ++++--------------- libraries/physics/src/EntityMotionState.cpp | 16 +++----------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp index 98ec154d01..017cb289f0 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp @@ -79,22 +79,9 @@ void RenderableDebugableEntityItem::render(EntityItem* entity, RenderArgs* args) glm::vec4 yellowColor(1.0f, 1.0f, 0.2f, 1.0f); renderBoundingBox(entity, args, 0.3f, yellowColor); } + + if (PhysicsEngine::physicsInfoIsActive(entity->getPhysicsInfo())) { + renderHoverDot(entity, args); + } } - - if (PhysicsEngine::physicsInfoIsActive(entity->getPhysicsInfo())) { - renderHoverDot(entity, args); - } - - glm::vec3 position; - glm::quat rotation; - - // - // XXX for future debugging - // - // if (PhysicsEngine::getBodyLocation(entity->getPhysicsInfo(), position, rotation)) { - // glm::vec3 positionOffset = glm::abs(position - entity->getPosition()); - // if (positionOffset[0] > 0.001 || positionOffset[1] > 0.001 || positionOffset[2] > 0.001) { - // qDebug() << positionOffset[0] << positionOffset[1] << positionOffset[2]; - // } - // } } diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 1e5bdac32d..1428287f8f 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -48,7 +48,6 @@ EntityMotionState::~EntityMotionState() { } void EntityMotionState::updateServerPhysicsVariables(uint32_t flags) { - /* if (flags & EntityItem::DIRTY_POSITION) { _sentPosition = _entity->getPosition(); } @@ -61,7 +60,6 @@ void EntityMotionState::updateServerPhysicsVariables(uint32_t flags) { if (flags & EntityItem::DIRTY_ANGULAR_VELOCITY) { _sentAngularVelocity = _entity->getAngularVelocity(); } - */ } // virtual @@ -96,17 +94,9 @@ bool EntityMotionState::isMoving() const { } bool EntityMotionState::isMovingVsServer() const { - // auto alignmentDot = glm::abs(glm::dot(_sentRotation, _entity->getRotation())); - // if (glm::distance(_sentPosition, _entity->getPosition()) > IGNORE_POSITION_DELTA || - // alignmentDot < IGNORE_ALIGNMENT_DOT) { - // return true; - // } - // return false; - - if (glm::length(_entity->getVelocity()) > IGNORE_LINEAR_VELOCITY_DELTA) { - return true; - } - if (glm::length(_entity->getAngularVelocity()) > IGNORE_ANGULAR_VELOCITY_DELTA) { + auto alignmentDot = glm::abs(glm::dot(_sentRotation, _entity->getRotation())); + if (glm::distance(_sentPosition, _entity->getPosition()) > IGNORE_POSITION_DELTA || + alignmentDot < IGNORE_ALIGNMENT_DOT) { return true; } return false;